Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
import { FileType, formatFileSize } from '@nextcloud/files'
import { useHotKey } from '@nextcloud/vue/composables/useHotKey'
import { defineComponent } from 'vue'
import { t } from '@nextcloud/l10n'
import NcDateTime from '@nextcloud/vue/components/NcDateTime'

import { useNavigation } from '../composables/useNavigation.ts'
Expand Down Expand Up @@ -208,6 +209,25 @@ export default defineComponent({
return t('files', 'Unknown file type')
}

if (window.OC?.MimeTypeList?.names?.[this.source.mime]) {
return window.OC.MimeTypeList.names[this.source.mime]
}

const baseType = this.source.mime.split('/')[0]
const ext = this.source?.extension?.toUpperCase().replace(/^\./, '') || ''
if (baseType === 'image') {
return t('files', '{ext} image', { ext })
}
if (baseType === 'video') {
return t('files', '{ext} video', { ext })
}
if (baseType === 'audio') {
return t('files', '{ext} audio', { ext })
}
if (baseType === 'text') {
return t('files', '{ext} text', { ext })
}

return this.source.mime
},
size() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function generateFile(array $aliases, array $names): string {

$namesOutput = '';
foreach ($names as $key => $name) {
if (str_starts_with($key, '_')) {
if (str_starts_with($key, '_') || trim($name) === '') {
// Skip internal names
continue;
}
Expand Down
24 changes: 22 additions & 2 deletions core/js/mimetypelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,19 @@ OC.MimeTypeList={
"x-office-spreadsheet"
],
themes: [],
names: {'application/epub+zip': t('core', "Electronic book document"),
names: {'application/cmd': t('core', "Windows Command Script"),
'application/epub+zip': t('core', "Electronic book document"),
'application/font-sfnt': t('core', "TrueType Font Collection"),
'application/font-woff': t('core', "Web Open Font Format"),
'application/gpx+xml': t('core', "GPX geographic data"),
'application/gzip': t('core', "Gzip archive"),
'application/illustrator': t('core', "Adobe Illustrator document"),
'application/java': t('core', "Java source code"),
'application/javascript': t('core', "JavaScript source code"),
'application/json': t('core', "JSON document"),
'application/msword': t('core', "Word document"),
'application/msaccess': t('core', "Microsoft Access database"),
'application/msonenote': t('core', "Microsoft OneNote document"),
'application/msword': t('core', "Microsoft Word document"),
'application/octet-stream': t('core', "Unknown"),
'application/pdf': t('core', "PDF document"),
'application/postscript': t('core', "PostScript document"),
Expand All @@ -171,6 +178,7 @@ OC.MimeTypeList={
'application/vnd.ms-excel.sheet.binary.macroEnabled.12': t('core', "Excel 2007 binary spreadsheet"),
'application/vnd.ms-excel.sheet.macroEnabled.12': t('core', "Excel spreadsheet"),
'application/vnd.ms-excel.template.macroEnabled.12': t('core', "Excel spreadsheet template"),
'application/vnd.ms-outlook': t('core', "Outlook Message"),
'application/vnd.ms-powerpoint': t('core', "PowerPoint presentation"),
'application/vnd.ms-powerpoint.addin.macroEnabled.12': t('core', "PowerPoint add-in"),
'application/vnd.ms-powerpoint.presentation.macroEnabled.12': t('core', "PowerPoint presentation"),
Expand Down Expand Up @@ -202,7 +210,9 @@ OC.MimeTypeList={
'application/x-7z-compressed': t('core', "7-zip archive"),
'application/x-blender': t('core', "Blender scene"),
'application/x-bzip2': t('core', "Bzip2 archive"),
'application/x-deb': t('core', "Debian package"),
'application/x-fictionbook+xml': t('core', "FictionBook document"),
'application/x-font': t('core', "Unknown font"),
'application/x-krita': t('core', "Krita document"),
'application/x-mobipocket-ebook': t('core', "Mobipocket e-book"),
'application/x-msi': t('core', "Windows Installer package"),
Expand All @@ -218,19 +228,24 @@ OC.MimeTypeList={
'audio/mp4': t('core', "MPEG-4 audio"),
'audio/mpeg': t('core', "MP3 audio"),
'audio/ogg': t('core', "Ogg audio"),
'audio/wav': t('core', "RIFF\/WAVe standard Audio"),
'audio/webm': t('core', "WebM audio"),
'audio/x-scpls': t('core', "MP3 ShoutCast playlist"),
'image/bmp': t('core', "Windows BMP image"),
'image/bpg': t('core', "Better Portable Graphics image"),
'image/emf': t('core', "EMF image"),
'image/gif': t('core', "GIF image"),
'image/heic': t('core', "HEIC image"),
'image/heif': t('core', "HEIF image"),
'image/jp2': t('core', "JPEG-2000 JP2 image"),
'image/jpeg': t('core', "JPEG image"),
'image/png': t('core', "PNG image"),
'image/svg+xml': t('core', "SVG image"),
'image/tga': t('core', "Truevision Targa image"),
'image/tiff': t('core', "TIFF image"),
'image/webp': t('core', "WebP image"),
'image/x-dcraw': t('core', "Digital raw image"),
'image/x-icon': t('core', "Windows Icon"),
'message/rfc822': t('core', "Email message"),
'text/calendar': t('core', "VCS\/ICS calendar"),
'text/css': t('core', "CSS stylesheet"),
Expand All @@ -239,13 +254,17 @@ OC.MimeTypeList={
'text/markdown': t('core', "Markdown document"),
'text/org': t('core', "Org-mode file"),
'text/plain': t('core', "Plain text document"),
'text/rtf': t('core', "Rich Text document"),
'text/vcard': t('core', "Electronic business card"),
'text/x-c++src': t('core', "C++ source code"),
'text/x-java-source': t('core', "Java source code"),
'text/x-ldif': t('core', "LDIF address book"),
'text/x-nfo': t('core', "NFO document"),
'text/x-php': t('core', "PHP source"),
'text/x-python': t('core', "Python script"),
'text/x-rst': t('core', "ReStructuredText document"),
'video/3gpp': t('core', "3GPP multimedia file"),
'video/MP2T': t('core', "MPEG video"),
'video/dv': t('core', "DV video"),
'video/mp2t': t('core', "MPEG-2 transport stream"),
'video/mp4': t('core', "MPEG-4 video"),
Expand All @@ -256,5 +275,6 @@ OC.MimeTypeList={
'video/x-flv': t('core', "Flash video"),
'video/x-matroska': t('core', "Matroska video"),
'video/x-ms-wmv': t('core', "Windows Media video"),
'video/x-msvideo': t('core', "AVI video"),
},
};
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/config/mimetypenames-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ while read -r MIME; do
MATCHED_COUNT=$((MATCHED_COUNT + 1))
else
echo " > Warning: No description found for MIME type $MIME ⚠️"
jq --arg key "$MIME" --arg value "" '. + {($key): $value}' "$OUTPUT_JSON.tmp" > "$OUTPUT_JSON.tmp2" && mv "$OUTPUT_JSON.tmp2" "$OUTPUT_JSON.tmp"
MISSING_COUNT=$((MISSING_COUNT + 1))
fi
done <<< "$MIME_TYPES"
Expand Down
74 changes: 72 additions & 2 deletions resources/config/mimetypenames.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,38 @@
"_comment4": "After any change to mimetypenames.json run:",
"_comment5": "./occ maintenance:mimetype:update-js",
"_comment6": "Otherwise your update won't propagate through the system.",
"_comment7": "You can search for missing formats in https://www.digipres.org/formats/.",
"_comment8": "You can also try to autocomplete missing formats by executing the mimetypenames-update.sh script.",
"application/cmd": "Windows Command Script",
"application/comicbook+7z": "",
"application/comicbook+ace": "",
"application/comicbook+rar": "",
"application/comicbook+tar": "",
"application/comicbook+truecrypt": "",
"application/comicbook+zip": "",
"application/coreldraw": "",
"application/epub+zip": "Electronic book document",
"application/font-sfnt": "TrueType Font Collection",
"application/font-woff": "Web Open Font Format",
"application/gpx+xml": "GPX geographic data",
"application/gzip": "Gzip archive",
"application/illustrator": "Adobe Illustrator document",
"application/internet-shortcut": "",
"application/java": "Java source code",
"application/javascript": "JavaScript source code",
"application/json": "JSON document",
"application/msword": "Word document",
"application/km": "",
"application/msaccess": "Microsoft Access database",
"application/msonenote": "Microsoft OneNote document",
"application/msword": "Microsoft Word document",
"application/octet-stream": "Unknown",
"application/pdf": "PDF document",
"application/postscript": "PostScript document",
"application/rss+xml": "RSS summary",
"application/sgf": "",
"application/vnd.android.package-archive": "Android package",
"application/vnd.excalidraw+json": "",
"application/vnd.garmin.tcx+xml": "",
"application/vnd.google-earth.kml+xml": "KML geographic data",
"application/vnd.google-earth.kmz": "KML geographic compressed data",
"application/vnd.lotus-wordpro": "Lotus Word Pro document",
Expand All @@ -24,11 +45,19 @@
"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "Excel 2007 binary spreadsheet",
"application/vnd.ms-excel.sheet.macroEnabled.12": "Excel spreadsheet",
"application/vnd.ms-excel.template.macroEnabled.12": "Excel spreadsheet template",
"application/vnd.ms-fontobject": "",
"application/vnd.ms-outlook": "Outlook Message",
"application/vnd.ms-powerpoint": "PowerPoint presentation",
"application/vnd.ms-powerpoint.addin.macroEnabled.12": "PowerPoint add-in",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "PowerPoint presentation",
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12": "PowerPoint presentation",
"application/vnd.ms-powerpoint.template.macroEnabled.12": "PowerPoint presentation template",
"application/vnd.ms-visio.drawing": "",
"application/vnd.ms-visio.drawing.macroEnabled.12": "",
"application/vnd.ms-visio.stencil": "",
"application/vnd.ms-visio.stencil.macroEnabled.12": "",
"application/vnd.ms-visio.template": "",
"application/vnd.ms-visio.template.macroEnabled.12": "",
"application/vnd.ms-word.document.macroEnabled.12": "Word document",
"application/vnd.oasis.opendocument.formula": "ODF formula",
"application/vnd.oasis.opendocument.graphics": "ODG drawing",
Expand All @@ -49,57 +78,97 @@
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "Excel 2007 spreadsheet",
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": "Excel 2007 spreadsheet template",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "Word 2007 document",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "",
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "Word 2007 document template",
"application/vnd.recordare.musicxml": "",
"application/vnd.recordare.musicxml+xml": "",
"application/vnd.visio": "Microsoft Visio document",
"application/vnd.wordperfect": "WordPerfect document",
"application/vnd.xmind.workbook": "",
"application/x-7z-compressed": "7-zip archive",
"application/x-bin": "",
"application/x-blender": "Blender scene",
"application/x-bzip2": "Bzip2 archive",
"application/x-cbr": "",
"application/x-deb": "Debian package",
"application/x-fictionbook+xml": "FictionBook document",
"application/x-font": "Unknown font",
"application/x-freemind": "",
"application/x-gimp": "",
"application/x-iwork-keynote-sffkey": "",
"application/x-iwork-numbers-sffnumbers": "",
"application/x-iwork-pages-sffpages": "",
"application/x-kdbx": "",
"application/x-krita": "Krita document",
"application/x-mobipocket-ebook": "Mobipocket e-book",
"application/x-ms-dos-executable": "",
"application/x-msdos-program": "",
"application/x-msi": "Windows Installer package",
"application/x-perl": "Perl script",
"application/x-photoshop": "",
"application/x-php": "PHP script",
"application/x-rar-compressed": "",
"application/x-shockwave-flash": "",
"application/x-tar": "Tar archive",
"application/x-tex": "",
"application/xml": "XML document",
"application/yaml": "YAML document",
"application/zip": "Zip archive",
"application/zstd": "Zstandard archive",
"audio/aac": "AAC audio",
"audio/flac": "FLAC audio",
"audio/m4b": "",
"audio/mp4": "MPEG-4 audio",
"audio/mpeg": "MP3 audio",
"audio/mpegurl": "",
"audio/ogg": "Ogg audio",
"audio/wav": "RIFF/WAVe standard Audio",
"audio/webm": "WebM audio",
"audio/x-scpls": "MP3 ShoutCast playlist",
"image/bmp": "Windows BMP image",
"image/bpg": "Better Portable Graphics image",
"image/emf": "EMF image",
"image/gif": "GIF image",
"image/heic": "HEIC image",
"image/heif": "HEIF image",
"image/jp2": "JPEG-2000 JP2 image",
"image/jpeg": "JPEG image",
"image/png": "PNG image",
"image/sgi": "",
"image/svg+xml": "SVG image",
"image/tga": "Truevision Targa image",
"image/tiff": "TIFF image",
"image/webp": "WebP image",
"image/x-dcraw": "Digital raw image",
"image/x-icon": "Windows Icon",
"message/rfc822": "Email message",
"text/asciidoc": "",
"text/calendar": "VCS/ICS calendar",
"text/css": "CSS stylesheet",
"text/csv": "CSV document",
"text/html": "HTML document",
"text/impress": "",
"text/markdown": "Markdown document",
"text/org": "Org-mode file",
"text/plain": "Plain text document",
"text/reveal": "",
"text/rtf": "Rich Text document",
"text/vcard": "Electronic business card",
"text/x-c": "",
"text/x-c++src": "C++ source code",
"text/x-h": "",
"text/x-java-source": "Java source code",
"text/x-ldif": "LDIF address book",
"text/x-nfo": "NFO document",
"text/x-php": "PHP source",
"text/x-python": "Python script",
"text/x-rst": "ReStructuredText document",
"text/x-shellscript": "",
"video/3gpp": "3GPP multimedia file",
"video/MP2T": "MPEG video",
"video/dv": "DV video",
"video/dvd": "",
"video/mp2t": "MPEG-2 transport stream",
"video/mp4": "MPEG-4 video",
"video/mpeg": "MPEG video",
Expand All @@ -108,5 +177,6 @@
"video/webm": "WebM video",
"video/x-flv": "Flash video",
"video/x-matroska": "Matroska video",
"video/x-ms-wmv": "Windows Media video"
"video/x-ms-wmv": "Windows Media video",
"video/x-msvideo": "AVI video"
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,19 @@ OC.MimeTypeList={
"x-office-spreadsheet"
],
themes: [],
names: {'application/epub+zip': t('core', "Electronic book document"),
names: {'application/cmd': t('core', "Windows Command Script"),
'application/epub+zip': t('core', "Electronic book document"),
'application/font-sfnt': t('core', "TrueType Font Collection"),
'application/font-woff': t('core', "Web Open Font Format"),
'application/gpx+xml': t('core', "GPX geographic data"),
'application/gzip': t('core', "Gzip archive"),
'application/illustrator': t('core', "Adobe Illustrator document"),
'application/java': t('core', "Java source code"),
'application/javascript': t('core', "JavaScript source code"),
'application/json': t('core', "JSON document"),
'application/msword': t('core', "Word document"),
'application/msaccess': t('core', "Microsoft Access database"),
'application/msonenote': t('core', "Microsoft OneNote document"),
'application/msword': t('core', "Microsoft Word document"),
'application/octet-stream': t('core', "Unknown"),
'application/pdf': t('core', "PDF document"),
'application/postscript': t('core', "PostScript document"),
Expand All @@ -172,6 +179,7 @@ OC.MimeTypeList={
'application/vnd.ms-excel.sheet.binary.macroEnabled.12': t('core', "Excel 2007 binary spreadsheet"),
'application/vnd.ms-excel.sheet.macroEnabled.12': t('core', "Excel spreadsheet"),
'application/vnd.ms-excel.template.macroEnabled.12': t('core', "Excel spreadsheet template"),
'application/vnd.ms-outlook': t('core', "Outlook Message"),
'application/vnd.ms-powerpoint': t('core', "PowerPoint presentation"),
'application/vnd.ms-powerpoint.addin.macroEnabled.12': t('core', "PowerPoint add-in"),
'application/vnd.ms-powerpoint.presentation.macroEnabled.12': t('core', "PowerPoint presentation"),
Expand Down Expand Up @@ -203,7 +211,9 @@ OC.MimeTypeList={
'application/x-7z-compressed': t('core', "7-zip archive"),
'application/x-blender': t('core', "Blender scene"),
'application/x-bzip2': t('core', "Bzip2 archive"),
'application/x-deb': t('core', "Debian package"),
'application/x-fictionbook+xml': t('core', "FictionBook document"),
'application/x-font': t('core', "Unknown font"),
'application/x-krita': t('core', "Krita document"),
'application/x-mobipocket-ebook': t('core', "Mobipocket e-book"),
'application/x-msi': t('core', "Windows Installer package"),
Expand All @@ -219,19 +229,24 @@ OC.MimeTypeList={
'audio/mp4': t('core', "MPEG-4 audio"),
'audio/mpeg': t('core', "MP3 audio"),
'audio/ogg': t('core', "Ogg audio"),
'audio/wav': t('core', "RIFF\/WAVe standard Audio"),
'audio/webm': t('core', "WebM audio"),
'audio/x-scpls': t('core', "MP3 ShoutCast playlist"),
'image/bmp': t('core', "Windows BMP image"),
'image/bpg': t('core', "Better Portable Graphics image"),
'image/emf': t('core', "EMF image"),
'image/gif': t('core', "GIF image"),
'image/heic': t('core', "HEIC image"),
'image/heif': t('core', "HEIF image"),
'image/jp2': t('core', "JPEG-2000 JP2 image"),
'image/jpeg': t('core', "JPEG image"),
'image/png': t('core', "PNG image"),
'image/svg+xml': t('core', "SVG image"),
'image/tga': t('core', "Truevision Targa image"),
'image/tiff': t('core', "TIFF image"),
'image/webp': t('core', "WebP image"),
'image/x-dcraw': t('core', "Digital raw image"),
'image/x-icon': t('core', "Windows Icon"),
'message/rfc822': t('core', "Email message"),
'text/calendar': t('core', "VCS\/ICS calendar"),
'text/css': t('core', "CSS stylesheet"),
Expand All @@ -240,13 +255,17 @@ OC.MimeTypeList={
'text/markdown': t('core', "Markdown document"),
'text/org': t('core', "Org-mode file"),
'text/plain': t('core', "Plain text document"),
'text/rtf': t('core', "Rich Text document"),
'text/vcard': t('core', "Electronic business card"),
'text/x-c++src': t('core', "C++ source code"),
'text/x-java-source': t('core', "Java source code"),
'text/x-ldif': t('core', "LDIF address book"),
'text/x-nfo': t('core', "NFO document"),
'text/x-php': t('core', "PHP source"),
'text/x-python': t('core', "Python script"),
'text/x-rst': t('core', "ReStructuredText document"),
'video/3gpp': t('core', "3GPP multimedia file"),
'video/MP2T': t('core', "MPEG video"),
'video/dv': t('core', "DV video"),
'video/mp2t': t('core', "MPEG-2 transport stream"),
'video/mp4': t('core', "MPEG-4 video"),
Expand All @@ -257,6 +276,7 @@ OC.MimeTypeList={
'video/x-flv': t('core', "Flash video"),
'video/x-matroska': t('core', "Matroska video"),
'video/x-ms-wmv': t('core', "Windows Media video"),
'video/x-msvideo': t('core', "AVI video"),
'my-custom/mimetype': t('core', "Custom Document"),
},
};
Loading
Loading