Skip to content

Commit

Permalink
fix: respect mimetypes and aliases for file previews
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Oct 15, 2024
1 parent 700aa58 commit 516ac9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ describe('FilePreview.vue', () => {
availableHandlers: [{
mimes: ['image/png', 'image/jpeg'],
}],
mimetypes: ['image/png', 'image/jpeg'],
}

const wrapper = shallowMount(FilePreview, {
Expand Down Expand Up @@ -423,6 +424,7 @@ describe('FilePreview.vue', () => {
availableHandlers: [{
mimes: ['video/mp4', 'image/jpeg', 'image/png', 'image/gif'],
}],
mimetypes: ['video/mp4', 'image/jpeg', 'image/png', 'image/gif'],
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,7 @@ export default {
},

isViewerAvailable() {
if (!OCA.Viewer) {
return false
}

const availableHandlers = OCA.Viewer.availableHandlers
for (let i = 0; i < availableHandlers.length; i++) {
if (availableHandlers[i]?.mimes?.includes && availableHandlers[i].mimes.includes(this.file.mimetype)) {
return true
}
}

return false
return OCA.Viewer?.mimetypes?.includes(this.file.mimetype)
},

isVoiceMessage() {
Expand Down

0 comments on commit 516ac9e

Please sign in to comment.