Skip to content

Conversation

AIlkiv
Copy link
Contributor

@AIlkiv AIlkiv commented Apr 26, 2025

  • Resolves: #

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

@AIlkiv AIlkiv requested review from a team and skjnldsv as code owners April 26, 2025 12:56
@AIlkiv AIlkiv requested review from Altahrim, artonge and susnux and removed request for a team April 26, 2025 12:56
@susnux susnux added enhancement 3. to review Waiting for reviews labels Apr 26, 2025
@susnux susnux requested a review from juliusknorr April 26, 2025 20:06
@susnux susnux added this to the Nextcloud 32 milestone Apr 26, 2025
@AIlkiv AIlkiv force-pushed the feature/public-link-file-preview-widget branch from 40357e0 to d7faa50 Compare May 7, 2025 12:38
@susnux
Copy link
Contributor

susnux commented May 7, 2025

cc @juliusknorr as reference picker / widget is mostly office

@AIlkiv
Copy link
Contributor Author

AIlkiv commented May 8, 2025

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.

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

@juliusknorr juliusknorr force-pushed the feature/public-link-file-preview-widget branch from d7faa50 to 2591948 Compare June 10, 2025 13:27
return $reference;
}

public function resolveReferencePublic(string $referenceText, string $shareToken): ?IReference {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Member

@juliusknorr juliusknorr left a 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

@juliusknorr juliusknorr force-pushed the feature/public-link-file-preview-widget branch from 2591948 to 24f87a9 Compare June 12, 2025 05:50
Copy link
Member

@blizzz blizzz left a 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)

Comment on lines 148 to 149
'x' => 1600,
'y' => 630,
Copy link
Member

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?

@AIlkiv AIlkiv force-pushed the feature/public-link-file-preview-widget branch 4 times, most recently from 65fa5c0 to 12d5d9b Compare July 10, 2025 10:28
Signed-off-by: ailkiv <a.ilkiv.ye@gmail.com>
@AIlkiv AIlkiv force-pushed the feature/public-link-file-preview-widget branch from 90672a8 to a248007 Compare July 10, 2025 19:53
@AIlkiv
Copy link
Contributor Author

AIlkiv commented Jul 10, 2025

Please adjust your commit message to pass CI:

- feature(files): add support for viewing public links in widget
+ feat(files): add support for viewing public links in widget

Also please run the code fixer locally:

composer cs:fix

@susnux done

Copy link
Member

@nickvergessen nickvergessen left a 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

Copy link
Member

@provokateurin provokateurin left a 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(),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'size' => $node->getSize(),
'size' => (string)$node->getSize(),

'mimetype' => $node->getMimetype(),
'mtime' => $node->getMTime(),
'preview-available' => $this->previewManager->isAvailable($node),
'is-public-link' => true,
Copy link
Member

@provokateurin provokateurin Jul 11, 2025

Choose a reason for hiding this comment

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

Suggested change
'is-public-link' => true,
'is-public-link' => 'yes',

'link' => $reference->getUrl(),
'mimetype' => $node->getMimetype(),
'mtime' => $node->getMTime(),
'preview-available' => $this->previewManager->isAvailable($node),
Copy link
Member

@provokateurin provokateurin Jul 11, 2025

Choose a reason for hiding this comment

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

Suggested change
'preview-available' => $this->previewManager->isAvailable($node),
'preview-available' => $this->previewManager->isAvailable($node) ? 'yes' : 'no',

This was referenced Aug 22, 2025
This was referenced Sep 2, 2025
This was referenced Sep 25, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
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.

7 participants