Correctly read symlinks from zip files

This already worked for tar files, but symlinks in .zip files were
treated as regular files.
This commit is contained in:
David Leadbeater
2025-11-14 12:50:01 +11:00
parent ff8cf9928e
commit 19892ecfd1

View File

@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"os"
"strings"
"github.com/c2h5oh/datasize"
@@ -144,7 +145,11 @@ func ExtractZip(reader io.Reader) (*Manifest, error) {
return nil, fmt.Errorf("zip: %s: %w", file.Name, err)
}
manifestEntry.Type = Type_InlineFile.Enum()
if file.Mode()&os.ModeSymlink != 0 {
manifestEntry.Type = Type_Symlink.Enum()
} else {
manifestEntry.Type = Type_InlineFile.Enum()
}
manifestEntry.Size = proto.Int64(int64(file.UncompressedSize64))
manifestEntry.Data = fileData
} else {