Skip to content

Improved SVG metadata generation - #3022

Open
girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/2967
Open

Improved SVG metadata generation#3022
girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/2967

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Closes #2967

Summary

Handled the SVG attachment metadata generation by adding comprehensive error handling for various edge cases.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.33 KB 178.33 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 172.49 KB 172.49 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 439.82 KB 439.82 KB 0 B (0.00%)

@pirate-bot

pirate-bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 16f03f2 is ready 🛎️!

@pirate-bot

pirate-bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":539.59,"q50":549.47,"q75":571.73,"cnt":10}, firstPaint: {"q25":1601.18,"q50":2014.12,"q75":2360.72,"cnt":10}, domContentLoaded: {"q25":4425.02,"q50":4465.18,"q75":4498.11,"cnt":10}, loaded: {"q25":4429.05,"q50":4469.12,"q75":4501.85,"cnt":10}, firstContentfulPaint: {"q25":3320.9,"q50":3357.16,"q75":3368.64,"cnt":10}, firstBlock: {"q25":20572.17,"q50":20744.88,"q75":21679.15,"cnt":10}, type: {"q25":36.52,"q50":40.57,"q75":44.14,"cnt":10}, typeWithoutInspector: {"q25":31.08,"q50":35.35,"q75":39.89,"cnt":10}, typeWithTopToolbar: {"q25":42.93,"q50":47.36,"q75":53.17,"cnt":10}, typeContainer: {"q25":20.51,"q50":21.46,"q75":23.48,"cnt":10}, focus: {"q25":178.18,"q50":181.49,"q75":185.51,"cnt":10}, inserterOpen: {"q25":54.19,"q50":62.6,"q75":65.32,"cnt":10}, inserterSearch: {"q25":33.7,"q50":36.79,"q75":38.21,"cnt":10}, inserterHover: {"q25":5.86,"q50":6.31,"q75":6.95,"cnt":20}, loadPatterns: {"q25":2264.38,"q50":2307.69,"q75":2453.45,"cnt":10}, listViewOpen: {"q25":296.18,"q50":300.68,"q75":312.31,"cnt":10}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves SVG attachment metadata generation by safely handling invalid files and parser failures.

Changes:

  • Adds guards for missing, unreadable, malformed, or dimensionless SVGs.
  • Adds unit tests for failure and success paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
inc/class-main.php Adds safe SVG validation and parsing.
tests/test-svg-upload.php Tests SVG metadata edge cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test-svg-upload.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

SVG metadata generation crashes when XML parsing returns false

5 participants