itchio / itch.io

:bug: Public itch.io issues tracker and documentation - use support instead for private information!
https://itch.io/support
240 stars 25 forks source link

Gzipped files in web archive are automatically decompressed after upload, breaking web builds #1180

Open Enichan opened 3 years ago

Enichan commented 3 years ago

When uploading a new web build using butler, where the build being provided to butler is contained within a zip, and that zip file contains a gzipped file (.gz, but changing the extension to for example .bin causes the same behavior), the gzipped file inside the archive will be decompressed before being served to users playing the web build.

This breaks web builds which expect gzipped content, as they will attempt to inflate the content, but it is already inflated by itch when uploaded, causing an error. I had to work around this for the file "scripts.gz" in Super Bernie World by making my preloader check for the gzip header (0x1F 0x8B 0x08) and assuming the binary blob was already inflated.

This is a recent regression that does not affect older builds using the same preloader, as evidenced by the Lore Finder Kickstarter demo, which serves scripts.gz in its deflated form as expected. Steps to verify this bug:

  1. Visit Super Bernie World's itch page, open Chrome DevTools, switch to Network, and click the Play button. Click on "scripts.gz?hash=C2T8taSL5pHyYY8Za%2B%2FWcA%3D%3D" and select Preview. Plain-text will appear
  2. Visit Lore Finder's itch page, do the same, selecting "scripts.gz?hash=pw1msj7Q9VtpwTp8bWjZrQ%3D%3D" this time and select Preview. Binary data will appear

SBW scripts.gz uploaded on 2021-04-10: image

LF scripts.gz uploaded previously: image

Enichan commented 3 years ago

After further investigation I have found out that this does not happen with executable builds, only web builds.

redjack-gdg commented 1 month ago

I'm facing the same problem, please fix it. Thanks in advance!