fix: preserve responsive WebP in Jimp fallback - #2641
Open
AnnoyingTechnology wants to merge 1 commit into
Open
Conversation
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.
Closes #2640.
What this fixes
Publii currently falls back from Sharp to Jimp when the Sharp worker fails. With
forceWebpenabled, Jimp writes the source format tofallbackDestinationPath, while the renderer still emits.webpresponsive image URLs. This leaves generated and deployed sites with missing responsive images.This PR makes the fallback preserve the requested image format:
destinationPathwhen WebP conversion is enabled;Sharp remains the default and fast path. The WASM codec is loaded only when Jimp needs WebP support.
Why this does not change the Sharp worker
The reproduced Sharp crash is the documented Electron/Linux GLib symbol conflict, tracked in electron/electron#46323. The same Sharp 0.34.3 operation succeeds under standalone Node, but Publii does not bundle a separate Node runtime and cannot safely assume a compatible system Node exists. This change fixes the Publii-owned fallback contract independently of that upstream runtime issue.
Verification
destinationPath.webpand does not write the PNG fallback.git diff --checkand Node syntax checks pass.Targeted tests:
Full existing backend suite:
The three failures are pre-existing
feed-link.spec.jswhitespace expectations and are unrelated to this change.