Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix context menu in public links #6558

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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