Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Windows zip file #816

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/archive/zip/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func New(f io.Writer, matcher sauceignore.Matcher) (Writer, error) {

// Add adds the file at src to the destination dst in the archive and returns a count of
// the files added to the archive, as well the length of the longest path.
// The added file names should not contain any backslashes according to the specification outlined in
// https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT.
// It's essential to adhere to this specification to ensure compatibility and
// proper functioning of the files across different systems and platforms.
func (w *Writer) Add(src, dst string) (count int, length int, err error) {
finfo, err := os.Stat(src)
if err != nil {
Expand All @@ -57,7 +61,7 @@ func (w *Writer) Add(src, dst string) (count int, length int, err error) {
// The trailing slash denotes a directory entry.
target = fmt.Sprintf("%s/", target)
}
fileWriter, err := w.W.Create(target)
fileWriter, err := w.W.Create(filepath.ToSlash(target))
if err != nil {
return 0, 0, err
}
Expand Down