Skip to content

Commit

Permalink
Merge pull request #13245 from nextcloud/backport/13242/stable30
Browse files Browse the repository at this point in the history
  • Loading branch information
Antreesy committed Sep 10, 2024
2 parents ce2703f + 7377552 commit 64f630b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export default {
},
hasTemporaryImageUrl() {
return this.file.mimetype.startsWith('image/') && this.file.localUrl
return SHARED_ITEM.MEDIA_ALLOWED_PREVIEW.includes(this.file.mimetype) && this.file.localUrl
},
wrapperTabIndex() {
Expand Down
7 changes: 7 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ export const SHARED_ITEM = {
RECORDING: 'recording',
VOICE: 'voice',
},
MEDIA_ALLOWED_PREVIEW: [
'image/gif',
'image/jpeg',
'image/jpg',
'image/png',
'image/webp',
],
}

export const WEBINAR = {
Expand Down
3 changes: 2 additions & 1 deletion src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { t } from '@nextcloud/l10n'
import moment from '@nextcloud/moment'
import { getUploader } from '@nextcloud/upload'

import { SHARED_ITEM } from '../constants.js'
import { getDavClient } from '../services/DavClient.js'
import { EventBus } from '../services/EventBus.js'
import {
Expand Down Expand Up @@ -239,7 +240,7 @@ const actions = {

// Get localurl for some image previews
let localUrl = ''
if (file.type === 'image/png' || file.type === 'image/gif' || file.type === 'image/jpeg') {
if (SHARED_ITEM.MEDIA_ALLOWED_PREVIEW.includes(file.type)) {
localUrl = URL.createObjectURL(file)
} else if (isVoiceMessage) {
localUrl = file.localUrl
Expand Down

0 comments on commit 64f630b

Please sign in to comment.