Skip to content

Commit 9a00fe0

Browse files
committed
Merge #310 [V32] Fix file type column
2 parents 669959b + 828c814 commit 9a00fe0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,50 @@ export default defineComponent({
209209
return t('files', 'Unknown file type')
210210
}
211211
212+
// OpenDocument
213+
if (this.source.mime.includes('opendocument')) {
214+
const subtype = this.source.mime.split('.').pop()
215+
216+
const map = {
217+
text: 'Text',
218+
spreadsheet: 'Spreadsheet',
219+
presentation: 'Presentation',
220+
graphics: 'Drawing',
221+
chart: 'Diagram',
222+
formula: 'Formula',
223+
image: 'Image'
224+
}
225+
226+
const type = map[subtype] || subtype
227+
const label = t('files', '{type}', { type })
228+
return `OpenDocument ${label}`
229+
}
230+
231+
// Microsoft Office
232+
if (this.source.mime.includes('openxmlformats-officedocument')) {
233+
const parts = this.source.mime.split('.')
234+
const mainType = parts[parts.length - 2] // z.B. presentationml
235+
const subType = parts[parts.length - 1] // z.B. slideshow
236+
237+
const mainMap = {
238+
wordprocessingml: 'Word',
239+
spreadsheetml: 'Excel',
240+
presentationml: 'PowerPoint'
241+
}
242+
243+
const subMap = {
244+
document: 'Document',
245+
sheet: 'Spreadsheet',
246+
presentation: 'Presentation',
247+
slideshow: 'Slideshow',
248+
template: 'Template'
249+
}
250+
251+
const mainLabel = mainMap[mainType] || mainType
252+
const subLabel = subMap[subType] || subType
253+
return `${mainLabel} ${t('files', subLabel)}`
254+
}
255+
212256
if (window.OC?.MimeTypeList?.names?.[this.source.mime]) {
213257
return window.OC.MimeTypeList.names[this.source.mime]
214258
}
@@ -227,6 +271,9 @@ export default defineComponent({
227271
if (baseType === 'text') {
228272
return t('files', '{ext} text', { ext })
229273
}
274+
if (baseType === 'application') {
275+
return t('files', '{ext} file', { ext })
276+
}
230277
231278
return this.source.mime
232279
},

0 commit comments

Comments
 (0)