nextcloud / viewer

🖼 Simple file viewer with slideshow for media
GNU Affero General Public License v3.0
99 stars 54 forks source link

Fix open in public view #2492

Closed thlehmann-ionos closed 2 months ago

thlehmann-ionos commented 2 months ago

The bug

The app config "always_show_viewer" enables the preview for all mimetypes. If this config is not set and no handler is registered for a mimetype, the file will be downloaded.

In the share/public view, with this config enabled some file types were downloaded instead of opened in the preview.

The code would not progress up to Viewer's openFileInfo() because it would not find a preview component candidate in 1 to even attempt opening the preview.

The fix

As per reverse engineering it was found that special string "all" is used as symbol for handling any mimetype (at least in 2).

The decision was made to change the special mimetype for a registered previewer to "all", because then handling any file is already coverered this way.

All discovered places:

  1. Files/fileactions: getDefaultFileAction() 2
  2. Shares: attach(), "fileActionsReady" event handler, registerAction() call 3
thlehmann-ionos commented 2 months ago

Pull request accidentally created to the wrong target repository. I'm sorry for the noise.

github-actions[bot] commented 2 months ago

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