Skip to content

Conversation

@provokateurin
Copy link
Member

Summary

Instead of providing the option to generate fallback previews this PR changes it to always generate some kind of preview if possible.
I don't see a reason why we shouldn't ever fallback to the mimetype or symbolic icon in case we are not able to generate a proper preview or it's a folder.
This also improves the UX, in case developers forget to manually request the mimeFallback, as now the users still see some preview.

Checklist

@provokateurin provokateurin added enhancement 3. to review Waiting for reviews labels Feb 3, 2025
@provokateurin provokateurin added this to the Nextcloud 32 milestone Feb 3, 2025
@provokateurin provokateurin changed the title chore(core): Deprecate PreviewController::getPreview() endpoint fix(core): Always try to generate some kind of preview Feb 3, 2025
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
@provokateurin provokateurin force-pushed the fix/core/preview-generation branch from 2aef985 to c75fba9 Compare February 3, 2025 09:59
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.

PHP changes are legit, but I do not know enough about this to judge the API change implied here.

@provokateurin
Copy link
Member Author

The API change itself is backwards compatible, since the removed parameters are just ignored now. Any client still sending them will not notice that they are not used anymore.

@susnux
Copy link
Contributor

susnux commented Feb 4, 2025

The API change itself is backwards compatible, since the removed parameters are just ignored now. Any client still sending them will not notice that they are not used anymore.

It will change the behavior as you now get the 303 for the mimetype even if you do not request it.
Meaning for files e.g. you get a "preview" even if there is none and instead should display the inline svg.

Not sure if this is bad or not. But a safer approach would be to reduce this to only the folder mime type change.

@provokateurin
Copy link
Member Author

It will change the behavior as you now get the 303 for the mimetype even if you do not request it.
Meaning for files e.g. you get a "preview" even if there is none and instead should display the inline svg.

You mean because a client would then chose to display it's own mimetype preview?
I get the idea, but feel like it is better to let the server handle this entirely.
Maybe @nextcloud/desktop, @nextcloud/ios and @nextcloud/android know if your clients behave this way and this change would result in unexpected behavior?

@susnux
Copy link
Contributor

susnux commented Feb 7, 2025

You mean because a client would then chose to display it's own mimetype preview?

Yes especially to get mimetype icons in the current color schema (dark / bright).

@provokateurin
Copy link
Member Author

provokateurin commented Feb 25, 2025

Yes especially to get mimetype icons in the current color schema (dark / bright).

IMO this should be a parameter and then the server would return the correct one.
Not sure if it is necessary and feasible though.

@mgallien
Copy link
Contributor

mgallien commented Mar 3, 2025

desktop files client would be fine and was not using the 2 removed arguments
that may make some of our code obsolete (we were manually redirecting the client to fetch the mime type icon from server when needed)

@susnux
Copy link
Contributor

susnux commented Mar 3, 2025

IMO this should be a parameter and then the server would return the correct one. Not sure if it is necessary and feasible though.

This is another issue and much harder, as we in general need to discuss how to proceed with icons.

@provokateurin
Copy link
Member Author

This is another issue and much harder, as we in general need to discuss how to proceed with icons.

Agreed, there are a bunch of problems with how we currently deal with icons. Maybe something to discuss in the Files Team Hack week ;)

This was referenced Aug 22, 2025
@provokateurin provokateurin deleted the fix/core/preview-generation branch September 27, 2025 16:36
@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

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants