Skip to content

Fonts and images (any binary files) are being corrupted during zip command #502

Description

@quagsirus

Binary files are being corrupted in the output zipfile when running yarn zip --theme <theme_name>.
For example, running these commands at the root of the repository:

$ sha256sum packages/edge/assets/images/*
cdf0a799b1cf35510c0ef21a491658b9305a495ae16c4fdbca35755a47a8725c  packages/edge/assets/images/default-skin.png
58adfd0cfdd98b573278a1cc3c3e5b9987c628169172c4d93da941403fbfb43e  packages/edge/assets/images/default-skin.svg
80d7ed3f3f4b50628f219778db814955e7d2007c05be88556778f90ee290715c  packages/edge/assets/images/preloader.gif
$ yarn zip --theme edge
$ unzip -d output ./packages/edge/dist/edge.zip
$ sha256sum output/assets/images/*
9e8e1e2043893d5256259d51a9c634f28b7282e6718d62c1e1a93172309f617b  output/assets/images/default-skin.png
58adfd0cfdd98b573278a1cc3c3e5b9987c628169172c4d93da941403fbfb43e  output/assets/images/default-skin.svg
33aed19ea515d19d6c16db412906121b7f9a291e7f48667616d5be5db217321a  output/assets/images/preloader.gif
Screenshot of an error saying that default-skin.png failed to load in an image editor The SVG is okay, but the PNG and GIF files are corrupted.

It's not limited to images, it applies to any binary file, including fonts formatted as WOFF or WOFF2.

$ sha256sum packages/edge/assets/fonts/inter-v8-latin-regular.woff*
9ec803cebad1a1287f35f96747871b72935ba6bd456ae916f09378053b7b5817  packages/edge/assets/fonts/inter-v8-latin-regular.woff
d56fec2159406ce1d4e284774fd1ee371018f131e28aa303ad1675edc76f20dc  packages/edge/assets/fonts/inter-v8-latin-regular.woff2
$ sha256sum output/assets/fonts/inter-v8-latin-regular.woff*
39518423327f7741c5407d3c9d36ba5ce12b6dfabde66a6153f8eda41c6b28eb  output/assets/fonts/inter-v8-latin-regular.woff
2d3ee4f5c6f788981a445e0b6ba49f7d247a1a2f4a636163362b5536e48db50f  output/assets/fonts/inter-v8-latin-regular.woff2

This completely breaks font loading in browsers:

Firefox console showing the error transcribed below this image
downloadable font: rejected by sanitizer (font-family: "Inter" style:normal weight:400 stretch:100 src index:1) source: https://<domain removed>/assets/fonts/inter-v8-latin-regular.woff2

This issue seems to be as a result of a breaking change in Gulp 5.0.0, "Default stream encoding to UTF-8" (https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md#500-2024-03-29) - this potentially means it's been a bug in this repo since e71799d on 2024-03-29?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions