diff --git a/part.go b/part.go index b0a5ac6..14a02d1 100644 --- a/part.go +++ b/part.go @@ -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] diff --git a/part_test.go b/part_test.go index b09919e..231efb7 100644 --- a/part_test.go +++ b/part_test.go @@ -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"},