Skip to content

Commit

Permalink
Merge pull request #20 from cristiancreteanu/fix-name-normalization-e…
Browse files Browse the repository at this point in the history
…scaping

Fix escaping in part name normalization
  • Loading branch information
qmuntal authored Dec 1, 2023
2 parents 7a1b32e + 1178565 commit 376b40c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion part.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ func escape(s string) string {
t[j+2] = '5'
j += 3
} else {
t[j], t[j+1], t[j+3] = '%', s[i+1], s[i+2]
t[j], t[j+1], t[j+2] = '%', s[i+1], s[i+2]
j += 3
i += 2
}
default:
c := s[i]
Expand Down
1 change: 1 addition & 0 deletions part_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestNormalizePartName(t *testing.T) {
{"percentSign2", args{"/docs%25/%41.xml"}, "/docs%25/A.xml"},
{"percentSignEnd", args{"/docs/a.%"}, "/docs/a.%25"},
{"pre-encoded", args{"/%3Aa.xml"}, "/%3Aa.xml"},
{"pre-encodedMixedWithNecessaryEscaped", args{"/%28a a.xml"}, "/%28a%20a.xml"},
{"chinese", args{"/传/傳.xml"}, "/%E4%BC%A0/%E5%82%B3.xml"},
{"fromSpec1", args{"/a/b.xml"}, "/a/b.xml"},
{"fromSpec2", args{"/a/ц.xml"}, "/a/%D1%86.xml"},
Expand Down

0 comments on commit 376b40c

Please sign in to comment.