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

[stable30] Show error when trying to open a shared PDF without download permissions #1098

Draft
wants to merge 3 commits into
base: stable30
Choose a base branch
from

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Dec 7, 2024

Backport of #1077

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

"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]>
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, 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
handling the error also in that case was not trivial 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]>
@backportbot backportbot bot requested review from Antreesy and danxuliu December 7, 2024 10:36
@backportbot backportbot bot added this to the Nextcloud 30.0.4 milestone Dec 7, 2024
@Antreesy Antreesy force-pushed the backport/1077/stable30 branch from 0f581e5 to 152cfc2 Compare December 9, 2024 11:48
@Antreesy
Copy link
Contributor

Antreesy commented Dec 9, 2024

/compile /

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

Antreesy commented Dec 9, 2024

Tested for registered users, but public share links do not provide this.file.shareAttributes
Moreover, it is even possible to open preview (but not save/print/download)

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.

4 participants