Skip to content
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

SVG files get automatically downloaded with right-click -> open image in new tab #4563

Closed
mgunyho opened this issue Aug 29, 2023 · 2 comments

Comments

@mgunyho
Copy link

mgunyho commented Aug 29, 2023

Detailed description of the problem

If I upload an SVG file to a notebook, and right-click -> open in new tab, the file is force-downloaded

Expected Behavior

SVG images should not be force-downloaded but just shown in a new tab, like the behavior is for e.g. PNG images currently.

Steps to reproduce the behavior

  1. Attach an SVG image to an experiment and insert in text at cursor position
  2. Go back to view mode and right-click -> open in new tab on the SVG image in the text (not in the attachment box)

What eLabFTW version are you using? Visible in bottom right of a page.

4.5.14, but also happens on the demo instance

Do you have any idea what may have caused this?

No response

Do you have an idea how to solve the issue?

I believe this can be solved by adding image/svg+xml (see e.g. here) to this list: https://github.com/elabftw/elabftw/blob/master/src/controllers/DownloadController.php#L92

Additional information

I think this may be related to #3797

@NicolasCARPi
Copy link
Contributor

Hello,

There is a security risk with SVG files (as they can contain javascript), but it seems the CSP is taking care of it, so I have enabled the display of SVG files in browser, like you suggested.

Best,
~Nico

@mgunyho
Copy link
Author

mgunyho commented Aug 29, 2023

Thanks for the quick response and resolution!

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

No branches or pull requests

2 participants