Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
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
14 changes: 8 additions & 6 deletions internal/util/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,17 @@ func ZipDir(dir string, outfilename string, opts ...ZipDirCallbackMatcher) error
if err != nil {
return fmt.Errorf("error getting relative path: %s. %w", file, err)
}
rf, err := os.Open(file)
if err != nil {
return fmt.Errorf("error opening file: %s. %w", file, err)
if !Exists(file) {
continue
}
defer rf.Close()
if len(opts) > 0 {
fi, err := rf.Stat()
fi, err := os.Stat(file)
if err != nil {
return fmt.Errorf("error getting file info: %s. %w", file, err)
}
var notok bool
for _, opt := range opts {
if !opt(fn, fi) {
rf.Close()
notok = true
break
}
Expand All @@ -145,6 +142,11 @@ func ZipDir(dir string, outfilename string, opts ...ZipDirCallbackMatcher) error
continue
}
}
rf, err := os.Open(file)
if err != nil {
return fmt.Errorf("error opening file: %s. %w", file, err)
}
defer rf.Close()
w, err := zw.Create(fn)
if err != nil {
return fmt.Errorf("error creating file: %s. %w", fn, err)
Expand Down
Loading