[mirror] Scalable static site server for Git forges (like GitHub Pages)

Support zstd inside zip files.

Given this is already depending on zstd I don't see a reason not to.

Can be tested with libarchive via: `bsdtar -a --options zip:compression=zstd -cf file.zip files...`

Reviewed-on: https://codeberg.org/git-pages/git-pages/pulls/91
Co-authored-by: David Leadbeater <dgl@dgl.cx>
Co-committed-by: David Leadbeater <dgl@dgl.cx>

authored by David Leadbeater David Leadbeater and committed by whitequark.org 62917824 62ef4a53

Changed files
+7
src
+7
src/extract.go
··· 153 153 return manifest, nil 154 154 } 155 155 156 + // Used for zstd decompression inside zip files, it is recommended to share this. 157 + var zstdDecomp = zstd.ZipDecompressor() 158 + 156 159 func ExtractZip(ctx context.Context, reader io.Reader, oldManifest *Manifest) (*Manifest, error) { 157 160 data, err := io.ReadAll(reader) 158 161 if err != nil { ··· 163 166 if err != nil { 164 167 return nil, err 165 168 } 169 + 170 + // Support zstd compression inside zip files. 171 + archive.RegisterDecompressor(zstd.ZipMethodWinZip, zstdDecomp) 172 + archive.RegisterDecompressor(zstd.ZipMethodPKWare, zstdDecomp) 166 173 167 174 // Detect and defuse zipbombs. 168 175 var totalSize uint64