File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -92,16 +92,9 @@ func NewDocumentURI(path string) DocumentURI {
92
92
encodedSegments [i ] = segment
93
93
} else {
94
94
segment = lowercaseDriveSegment (segment )
95
- chars := strings .SplitAfter (segment , "" )
96
- for i , c := range chars {
97
- // Spaces must be turned into `%20`. Otherwise, `url.QueryEscape`` encodes them to `+`.
98
- if c == " " {
99
- chars [i ] = "%20"
100
- } else {
101
- chars [i ] = url .QueryEscape (c )
102
- }
103
- }
104
- encodedSegments [i ] = strings .Join (chars , "" )
95
+ segment = url .QueryEscape (segment )
96
+ // Spaces must be turned into `%20`. Otherwise, `url.QueryEscape`` encodes them to `+`.
97
+ encodedSegments [i ] = strings .ReplaceAll (segment , "+" , "%20" )
105
98
}
106
99
}
107
100
urlPath := strings .Join (encodedSegments , "/" )
You can’t perform that action at this time.
0 commit comments