diff --git a/changelog/unreleased/enhancement-load-space-images-as-preview b/changelog/unreleased/enhancement-load-space-images-as-preview index 1d80c9cda07..10a4274caed 100644 --- a/changelog/unreleased/enhancement-load-space-images-as-preview +++ b/changelog/unreleased/enhancement-load-space-images-as-preview @@ -3,3 +3,4 @@ Enhancement: Load space images as preview We've added a new logic which renders space images as preview to minimize data traffic https://github.com/owncloud/web/pull/6529 +https://github.com/owncloud/web/pull/6558 diff --git a/packages/web-app-files/src/services/thumbnail.ts b/packages/web-app-files/src/services/thumbnail.ts index d27283de570..aa7b6dcab61 100644 --- a/packages/web-app-files/src/services/thumbnail.ts +++ b/packages/web-app-files/src/services/thumbnail.ts @@ -16,17 +16,20 @@ export class ThumbnailService { return !!this.capability?.version } + private get supportedMimeTypes() { + return this.capability?.supportedMimeTypes || [] + } + public isMimetypeSupported(mimeType: string, onlyImages = false) { - return onlyImages - ? mimeType.startsWith('image/') && this.capability.supportedMimeTypes.includes(mimeType) - : this.capability.supportedMimeTypes.includes(mimeType) + const mimeTypes = this.getSupportedMimeTypes(onlyImages ? 'image/' : null) + return mimeTypes.includes(mimeType) } public getSupportedMimeTypes(filter?: string) { if (!filter) { - return this.capability.supportedMimeTypes + return this.supportedMimeTypes } - return this.capability.supportedMimeTypes.filter((mimeType) => mimeType.startsWith(filter)) + return this.supportedMimeTypes.filter((mimeType) => mimeType.startsWith(filter)) } }