Repository navigation
[6.x] Keep the uploaded extension when the source preset doesn't convert the file - #15972
Merged
jasonvarga merged 1 commit intoNov 19, 2026
Merged
Conversation
…e file getNewExtension() gave an upload the source preset's format even when processSourceFile() stored the original file instead: for GIFs, files ImageValidator rejects, and when Glide throws. A GIF uploaded with an fm: webp source preset was saved as .webp containing GIF data, which Glide then rejects. processSourceFile() now records when it applied the preset, and getNewExtension() only changes the extension when it did.
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.
Fixes #15971
When a container's source preset sets a format (
fm),AssetUploader::getNewExtension()gives the upload that extension even whenUploader::processSourceFile()stored the original file instead. That happens for GIFs (always skipped), for filesImageValidatorrejects, and when Glide throws while applying the preset.For example, a GIF uploaded with an
fm: webpsource preset is saved asanimation.webpcontaining GIF data. Glide then rejects it asdoes not actually appear to be a valid image, so the upload fails when presets are warmed on upload, and the asset can't be used with theglidetag.processSourceFile()now records when it applied the preset, andgetNewExtension()only changes the extension when it did.Tests
Two new tests in
AssetTest, each uploading into a container whose source preset setsfm: png:Without the change, both files are saved as
.png. The existing source preset tests still pass.I also checked it in a fresh Statamic 6.42 site with an
fm: webpsource preset: a JPEG upload is still saved as.webp, and a GIF upload stays.gifand works with theglidetag.