-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feature(files): add support for viewing public links in widget #52478
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
base: master
Are you sure you want to change the base?
feature(files): add support for viewing public links in widget #52478
Conversation
40357e0 to
d7faa50
Compare
|
cc @juliusknorr as reference picker / widget is mostly office |
|
I found out that it doesn't work for pictures and office files that “hide download”. I'll try to investigate why it doesn't work. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
d7faa50 to
2591948
Compare
| return $reference; | ||
| } | ||
|
|
||
| public function resolveReferencePublic(string $referenceText, string $shareToken): ?IReference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public function resolveReferencePublic(string $referenceText, string $shareToken): ?IReference { | |
| public function resolveReferencePublic(string $referenceText, string $sharingToken): ?IReference { |
As suggested by psalm to fit the interface definition
juliusknorr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor nitpick as pointed out by the static analysis already, otherwise this is a very nice addition. Thanks a lot for this
2591948 to
24f87a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfamiliar with the reference providers, but looks good. Left a remark, otherwise what Julius said.
(was meant to be non-blocking)
| 'x' => 1600, | ||
| 'y' => 630, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure where these values come from, maybe worth to put them into a constant, or using an existing one?
65fa5c0 to
12d5d9b
Compare
Signed-off-by: ailkiv <[email protected]>
90672a8 to
a248007
Compare
@susnux done |
nickvergessen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objecting for now, will discuss later
provokateurin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rich object values must be strings and the current could should be failing due to this 🤔
| $reference->setRichObject('file', [ | ||
| 'id' => $fileToken, // security, public link should not show file id | ||
| 'name' => $node->getName(), | ||
| 'size' => $node->getSize(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'size' => $node->getSize(), | |
| 'size' => (string)$node->getSize(), |
| 'mimetype' => $node->getMimetype(), | ||
| 'mtime' => $node->getMTime(), | ||
| 'preview-available' => $this->previewManager->isAvailable($node), | ||
| 'is-public-link' => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'is-public-link' => true, | |
| 'is-public-link' => 'yes', |
| 'link' => $reference->getUrl(), | ||
| 'mimetype' => $node->getMimetype(), | ||
| 'mtime' => $node->getMTime(), | ||
| 'preview-available' => $this->previewManager->isAvailable($node), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'preview-available' => $this->previewManager->isAvailable($node), | |
| 'preview-available' => $this->previewManager->isAvailable($node) ? 'yes' : 'no', |
|
@nickvergessen Is there anything else I can do to improve this PR so that you will accept it? |
| $reference->setRichObject('file', null); | ||
| $reference->setAccessible(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to log a brute-force attempt or needs some kind of other protection to not allow users to iterate public share links.
But if we add that, I can get you bruteforce protected by propering a document with a lot of share links you don't have access to.
I'm not sure this is solvable in a sensible and working way at the moment, so my objection still stands
Summary
I added support for viewing public links to files.
For example: /index.php/s/Wnb3jd8PZqqd8kB or /s/Wnb3jd8PZqqd8kB
demo:
2025-04-26.15-34-15.mp4
I think this is an important PR for the entire community, because it will give us the opportunity to view videos and documents on the public page/collective (previously, this was not possible).
TODO
Checklist