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

Fix: Upload a svg without width and height set #161

Merged
merged 6 commits into from
Jul 26, 2024
Merged

Conversation

dobri1408
Copy link
Contributor

@dobri1408 dobri1408 commented Jul 23, 2024

If you upload an SVG that doesn't have width and height attribute, like the one found https://drive.google.com/file/d/15gPPxE-K5k8XYWmgreKX6aWD2FQ6zvM5/view?usp=sharing, the scaling will be incorrect. This occurs because the SVG utilities will default assume the dimensions are 1x1, despite the fact that the actual width and height can be derived from the viewBox attribute.

@mister-roboto
Copy link

@dobri1408 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@dobri1408
Copy link
Contributor Author

@jenkins-plone-org please run jobs

@dobri1408 dobri1408 requested a review from davisagli July 24, 2024 06:40
Copy link
Member

@mauritsvanrees mauritsvanrees left a comment

Choose a reason for hiding this comment

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

I tried it. Without this fix, when I upload your example SVG and go to @@images-test most scales have no images. Well, there are images, but they are basically invisible because they are indeed 1x1:

Screenshot 2024-07-26 at 23 46 12

With your fix, after uploading the image freshly for good measure, all images show up fine, most importantly the main one:

Screenshot 2024-07-26 at 23 54 45

Thanks!

A test would be good, to avoid regressions in the future. But it's a good fix, so I merge.

@mauritsvanrees mauritsvanrees merged commit 2db172f into master Jul 26, 2024
11 of 12 checks passed
@mauritsvanrees mauritsvanrees deleted the scale-svg branch July 26, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants