Skip to content

Commit

Permalink
Fix context menu in public links
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Mar 9, 2022
1 parent 9ada337 commit 9f1cdbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions packages/web-app-files/src/services/thumbnail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit 9f1cdbc

Please sign in to comment.