Skip to content

Commit

Permalink
Fix aliasing mimes
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Nov 9, 2022
1 parent 2d0eebf commit bbcd4ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,18 @@ export default {
}
// If no provided handler, or provided handler not found: try a supported handler with mime/mime-alias
if (!handler) {
handler = this.registeredHandlers[mime] ?? this.registeredHandlers[alias]
}
handler = this.registeredHandlers[alias] ?? this.registeredHandlers[mime]

this.theme = handler.theme ?? 'dark'
// if we don't have a handler for this mime, abort
if (!handler) {
logger.error('The following file could not be displayed', { fileInfo })
showError(t('viewer', 'There is no plugin available to display this file type'))
this.close()
return
// if we still don't have a handler for this mime, abort
if (!handler) {
logger.error('The following file could not be displayed', { fileInfo })
showError(t('viewer', 'There is no plugin available to display this file type'))
this.close()
return
}
}

this.theme = handler.theme ?? 'dark'
this.handlerId = handler.id

// check if part of a group, if so retrieve full files list
Expand Down Expand Up @@ -595,7 +595,7 @@ export default {
fileInfo = this.fileList[this.currentIndex]

// show file
this.currentFile = new File(fileInfo, mime, handler.component)
this.currentFile = new File(fileInfo, mime, this.components[mime])
this.updatePreviousNext()

// if sidebar was opened before, let's update the file
Expand Down

0 comments on commit bbcd4ef

Please sign in to comment.