Skip to content

Commit 86c126f

Browse files
author
Taka Nishida
committed
Fix non-latin-1 string error when uploading artifact
1 parent 4a08622 commit 86c126f

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

helpers/archives/gzip_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func writeGzipFile(w io.Writer, fileName string, fileInfo os.FileInfo) error {
2727
}
2828

2929
gz := gzip.NewWriter(w)
30-
gz.Header.Name = fileInfo.Name()
30+
gz.Header.Name = sanitizePath(fileInfo.Name())
3131
gz.Header.Comment = sanitizePath(fileName)
3232
gz.Header.ModTime = fileInfo.ModTime()
3333

helpers/archives/gzip_create_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ func TestGzipSanitization(t *testing.T) {
138138
content: []byte("content"),
139139
needsEncoding: true,
140140
},
141+
{
142+
name: "with non-ASCII filename",
143+
dir: "test",
144+
file: "TEST-日本語テスト.txt",
145+
content: []byte("content"),
146+
needsEncoding: true,
147+
},
141148
}
142149

143150
for _, tt := range tests {

0 commit comments

Comments
 (0)