Skip to content

Conversation

@akhil1508
Copy link
Contributor

@akhil1508 akhil1508 commented May 15, 2025

Summary

  • The exception thrown doesn't actually check if previews are disabled at storage or provider level; I fix that in this PR so that storage level disabling of preview works as expected

Before:

  • For an external storage mount with previews disabled
    image

After:

image

TODO

  • ...

Checklist

@akhil1508 akhil1508 requested a review from a team as a code owner May 15, 2025 09:54
@akhil1508 akhil1508 requested review from ArtificialOwl, come-nc and provokateurin and removed request for a team May 15, 2025 09:54
@provokateurin
Copy link
Member

I'm not sure if this is the right way, but changing a default value in the API should be avoided as it means a breaking change in the behavior. The root of the issue is likely somewhere else.

@provokateurin provokateurin requested a review from skjnldsv May 15, 2025 10:13
@akhil1508
Copy link
Contributor Author

akhil1508 commented May 15, 2025

but changing a default value in the API should be avoided as it means a breaking change in the behavior

@provokateurin I agree with your concern generally

However, in this case:

  • It doesn't seem like a sensible default to be true as it essentially means that the mount-level disabling of previews is only respected if the forceIcon attribute is set by a client to be false; but that should be respected at the backend by default
  • I did check the nextcloud server project code to see if any clients consuming this API there might be affected; doesn't seem like the case to me

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

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

but forceIcon should return an icon if preview is disabled, not compute a preview, no?

@provokateurin
Copy link
Member

That's what I think as well and it's why I said that I think the problem is elsewhere.

@akhil1508
Copy link
Contributor Author

but forceIcon should return an icon if preview is disabled, not compute a preview, no?

@come-nc @provokateurin I was not aware that this was the intention of the parameter; let me dig deeper then

@akhil1508 akhil1508 changed the title Set forceIcon to false by default for preview routes Fix: Set forceIcon to false by default for preview routes May 15, 2025
@akhil1508 akhil1508 force-pushed the dev/external-storage-previews branch from 913ba89 to e395304 Compare May 20, 2025 07:45
@akhil1508
Copy link
Contributor Author

@provokateurin @come-nc Please check now. Earlier the exception was thrown only if previews are disabled system-wide; now it is thrown if previews are not available for whatever reason using the isAvailable method

@akhil1508 akhil1508 force-pushed the dev/external-storage-previews branch from e395304 to e537500 Compare May 20, 2025 07:47
@provokateurin provokateurin changed the title Fix: Set forceIcon to false by default for preview routes fix: Throw exception in PreviewManager when preview is not available May 20, 2025
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.

Looks sane to me, the method definitely should have used isAvailable() since that checks if the storage allows/supports it.

@provokateurin
Copy link
Member

/backport to stable31

@provokateurin
Copy link
Member

/backport to stable30

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

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

👍

@come-nc come-nc added the 4. to release Ready to be released and/or waiting for tests to finish label May 20, 2025
@come-nc come-nc added this to the Nextcloud 32 milestone May 20, 2025
@come-nc
Copy link
Contributor

come-nc commented May 20, 2025

CI failure are unrelated for phpunit, and the others are because this comes from a fork.
Good to merge 👍

@sorbaugh sorbaugh merged commit edf21d9 into nextcloud:master May 20, 2025
171 of 180 checks passed
@github-actions
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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish feedback-requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Previews for files show up in external storages even when the previews option for storage is set to off

5 participants