Closed AdamMerrifield closed 5 months ago
Latest commit: e868666a2812e9ed931ec946a12f9005b4c57355
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
When restoring from the cache we only restore the image and not the metadata, which we re-read from the image. This could be an issue for other properties as well, which will end up missing when restore from the cache. Though in practice I'm not sure any properties besides format
and width
are used and I guess that format
is the only one that doesn't match what is read from the image, so this fix is probably fine for most use cases. I wonder if anyone is relying on getting the directives from the metadata. Perhaps we should remove them as I don't think they need to be there and the output will be different depending on whether you restore from the cache or not
Anyway, I think this change is fine, but we should probably update the comment to better clarify exactly what is happening
@benmccann comment has been updated, but I agree. I'm unsure of any other formats that something similar to this would occur with.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.49%. Comparing base (
37857f4
) to head (e868666
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Quick Checklist
[x] I have read the contributing guidelines
[x] I have written new tests, as applicable (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
[x] I have added a changeset, if applicable
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Bug fix
What is the new behavior (if this is a feature change)?
avif
files that are from the cache directory have the correct formatDoes this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?) No
Other information: Currently when an
avif
file read from cache, Sharp metadata returns{format: 'heif', compression: 'av1'...}
causing the file extension and Picture mime type to be incorrect. https://github.com/lovell/sharp/issues/2504 https://github.com/lovell/sharp/issues/3746The new test for
cache.avifFormat
will fail on imagetools@7.0.0