fix: fall back to viewBox when SVG logo lacks width/height - #184
Open
ayushsingh82 wants to merge 1 commit into
Open
fix: fall back to viewBox when SVG logo lacks width/height#184ayushsingh82 wants to merge 1 commit into
ayushsingh82 wants to merge 1 commit into
Conversation
get_svg_dimensions() only read the width/height XML attributes, so a valid square SVG with only a viewBox (a common export shape from design tools) failed validation with "Could not extract dimensions," contradicting the function's own error message which already claimed viewBox support. Parse viewBox as a fallback when width/height attributes are absent.
ayushsingh82
requested review from
Im-Madhur-Gupta,
QEDK,
iamvukasin and
keone
as code owners
August 7, 2026 04:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_svg_dimensions()inscripts/validate_tokens.pyonly read thewidth/heightXML attributes, so a valid square SVG exported with only aviewBox(a common shape from Figma/Illustrator) failed validation with "Could not extract dimensions." This contradicted the function's own error message, which already told contributors aviewBoxwas acceptable.viewBox="minX minY width height"whenwidth/heightattributes are absent, and uses its width/height for the square/min-size checks.Test plan
get_svg_dimensions()against all 89 existingmainnet/*/logo.svgfiles — identical output before and after (no regression on width/height-attribute SVGs).viewBox="0 0 256 256", no width/height attrs) now resolves to(256, 256)instead of failing.(None, None).uv run ruff checkanduv run ruff format --checkpass on the changed file.