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

Sharing: Do not show copy action when user doesn't have permissions #37802

Merged
merged 2 commits into from
May 3, 2023
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion apps/files_sharing/src/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import { getCapabilities } from '@nextcloud/capabilities'
}
if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) {
delete fileActions.actions.all.Download
if (fileData.permissions & OC.PERMISSION_UPDATE === 0) {
if ((fileData.permissions & OC.PERMISSION_UPDATE) === 0) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> (1 & 2 === 0)
0
> (1 & 2) === 0
true

😡

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always feel we do not put enough parenthesis in Nextcloud code, I tend to be paranoid about these things. There are so many operators it’s too hard to remember all priorities by heart.

// neither move nor copy is allowed, remove the action completely
delete fileActions.actions.all.MoveCopy
}
Expand Down