Skip to content

Commit 376b40c

Browse files
authored
Merge pull request #20 from cristiancreteanu/fix-name-normalization-escaping
Fix escaping in part name normalization
2 parents 7a1b32e + 1178565 commit 376b40c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

part.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ func escape(s string) string {
193193
t[j+2] = '5'
194194
j += 3
195195
} else {
196-
t[j], t[j+1], t[j+3] = '%', s[i+1], s[i+2]
196+
t[j], t[j+1], t[j+2] = '%', s[i+1], s[i+2]
197197
j += 3
198+
i += 2
198199
}
199200
default:
200201
c := s[i]

part_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func TestNormalizePartName(t *testing.T) {
3333
{"percentSign2", args{"/docs%25/%41.xml"}, "/docs%25/A.xml"},
3434
{"percentSignEnd", args{"/docs/a.%"}, "/docs/a.%25"},
3535
{"pre-encoded", args{"/%3Aa.xml"}, "/%3Aa.xml"},
36+
{"pre-encodedMixedWithNecessaryEscaped", args{"/%28a a.xml"}, "/%28a%20a.xml"},
3637
{"chinese", args{"/传/傳.xml"}, "/%E4%BC%A0/%E5%82%B3.xml"},
3738
{"fromSpec1", args{"/a/b.xml"}, "/a/b.xml"},
3839
{"fromSpec2", args{"/a/ц.xml"}, "/a/%D1%86.xml"},

0 commit comments

Comments
 (0)