Add a comment to explain why we look at file name for zip files

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
This commit is contained in:
Mario Loriedo
2024-02-19 12:38:05 +01:00
parent 95aa2c4e68
commit c42d3a74ed

View File

@ -34,6 +34,8 @@ func newDecompressor(compressedFilePath string, compressedFileContent []byte) de
switch {
case compressionType == archive.Xz:
return newXzDecompressor(compressedFilePath)
// Zip files are not guaranteed to have a magic number at the beginning
// of the file, so we need to use the file name to detect them.
case compressionType == archive.Uncompressed && hasZipSuffix:
return newZipDecompressor(compressedFilePath)
case compressionType == archive.Uncompressed: