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

[stable29] Show error when trying to open a shared PDF without download permissions #1097

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Dec 7, 2024

Backport of #1077

The extra commits from #1098 are not needed here, as download permissions in public shares were not taken into account before Nextcloud 30.

Besides that, before Nextcloud 30 download permissions used enabled rather than value, so the code was adjusted to that.

"canDownload" inverted the value of the "hideDownload" setting. However,
that was not accurate, as if the download is hidden the file can still
be downloaded. Moreover, it is possible to actually disallow downloads,
which is a different setting (using share attributes) than hiding it.

Therefore, to better differentiate between a hidden download and a
disabled download the previous "canDownload" was renamed (and adjusted
as needed) to "hideDownload".

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu force-pushed the backport/1077/stable29 branch from c252e57 to 726e160 Compare December 31, 2024 06:59
In order to show a PDF file it needs to be downloaded. Therefore, if a
shared PDF file does not have download permissions it is not possible to
show it (except for public shares, as in that case the download
permissions are not enforced), so now an error is shown instead.

The error is a custom one rather than a standard error from the viewer
(although with the same appearance) to better explain the reason.

Note that the error is shown only when the PDF file is loaded through
the viewer, which should be always the case. There is a fallback to
inject the UI in public shares in case the viewer is not available, but
as mentioned above download permissions are ignored in public shares and
that fallback should never be used anyway, so it was not taken into
account.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu force-pushed the backport/1077/stable29 branch from 726e160 to 4b3891b Compare January 7, 2025 03:38
@danxuliu
Copy link
Member

danxuliu commented Jan 7, 2025

/compile /

Signed-off-by: nextcloud-command <[email protected]>
@danxuliu
Copy link
Member

danxuliu commented Jan 7, 2025

CI failure is unrelated and fixed in #1105

@danxuliu danxuliu marked this pull request as ready for review January 7, 2025 03:49
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Tested

@blizzz blizzz mentioned this pull request Jan 8, 2025
10 tasks
@danxuliu danxuliu merged commit 449c2da into stable29 Jan 8, 2025
40 of 42 checks passed
@danxuliu danxuliu deleted the backport/1077/stable29 branch January 8, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants