Skip to content

Commit bf32eb5

Browse files
Copilotpan93412
andcommitted
fix: normalize path separators for cross-platform gitignore matching
Co-authored-by: pan93412 <28441561+pan93412@users.noreply.github.com>
1 parent bc26f37 commit bf32eb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/util/pack.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ func PackZipWithoutGitIgnoreFiles() ([]byte, error) {
8383

8484
// Check ignore patterns before processing
8585
if ignoreObject != nil {
86+
// Normalize path separators to forward slashes for cross-platform gitignore matching
87+
checkPath := filepath.ToSlash(path)
8688
// For directories, we need to check with trailing slash for proper gitignore matching
87-
checkPath := path
8889
if info.IsDir() {
89-
checkPath = path + "/"
90+
checkPath = checkPath + "/"
9091
}
9192

9293
if ignoreObject.MatchesPath(checkPath) {

0 commit comments

Comments
 (0)