fix: rewrite SVG asset references to PNG after raster-embedded conversion - #242
Open
mrbobbytables wants to merge 1 commit into
Open
mrbobbytables wants to merge 1 commit into
mrbobbytables wants to merge 1 commit into
Conversation
…sion import-architectures.mjs converts raster-embedded SVGs to PNG via rsvg-convert, but previously left the architecture record's assets list (and any inline markdown image references) pointing at the original .svg path, which no longer exists on disk. This caused validate:architectures to fail with 'missing asset ...svg' for architectures such as swisscom-cloud-native-telco and zeiss. Build record.assets from the actual post-sanitization asset directory listing instead of the pre-conversion source listing, and have sanitizeArchitectureAssets return a rename map so cleanMarkdown can rewrite any inline .svg image references in the imported body to the .png path that was actually written. Fixes #218 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
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
scripts/import-architectures.mjsconverts raster-embedded SVGs to PNG viarsvg-convert, but it left the architecture record'sassetslist (and any inline markdown image references) pointing at the original.svgpath, which no longer exists on disk once converted. This causednpm run validate:architecturesto fail in the scheduledImport reference architecturesworkflow with:Fix
record.assetsfrom the actual post-sanitization asset directory listing rather than the pre-conversion source file listing, so the catalog references the files that really exist on disk.sanitizeArchitectureAssetsnow returns a rename map (old-relative-path.svg -> new-relative-path.png) for every SVG it converts.cleanMarkdownuses that rename map to rewrite any inlinereferences in the imported architecture body to the.pngpath that was actually written, so the generated docs page doesn't link to a missing image either.Testing
npm run test:unit(55/55 passing)npm run checkrsvg-convertto confirm a converted SVG's markdown reference and directory listing are rewritten to.png.Fixes #218
— hive: backend=copilot
🐝 Hive Agent:
contributor| SHA:74ff41f