Skip to content

Commit

Permalink
Merge pull request #6558 from owncloud/fix-public-links-context-menu
Browse files Browse the repository at this point in the history
Fix context menu in public links
  • Loading branch information
kulmann authored Mar 9, 2022
2 parents e1e3265 + 9f1cdbc commit ae0f1ed
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 ae0f1ed

Please sign in to comment.