Skip to content

Commit

Permalink
fix: Filter out non-downloadable files in image picker
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Oct 16, 2024
1 parent 574ec4f commit b62f7c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/view/FilesAppIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ export default {

getFilePickerBuilder(t('richdocuments', 'Insert image from {name}', { name: OC.theme.name }))
.setMimeTypeFilter(['image/png', 'image/gif', 'image/jpeg', 'image/svg'])
.setFilter((node) => {
const downloadShareAttribute = JSON.parse(node.attributes['share-attributes']).find((shareAttribute) => shareAttribute.key === 'download')
const downloadPermissions = downloadShareAttribute !== undefined ? (downloadShareAttribute.enabled || downloadShareAttribute.value) : true
return (node.permissions & OC.PERMISSION_READ) && downloadPermissions
})
.addButton({
label: t('richdocuments', 'Insert image'),
callback: (files) => {
Expand Down

0 comments on commit b62f7c3

Please sign in to comment.