We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68cc092 commit ce73b88Copy full SHA for ce73b88
uri.go
@@ -92,16 +92,9 @@ func NewDocumentURI(path string) DocumentURI {
92
encodedSegments[i] = segment
93
} else {
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, "")
+ segment = url.QueryEscape(segment)
+ // Spaces must be turned into `%20`. Otherwise, `url.QueryEscape`` encodes them to `+`.
+ encodedSegments[i] = strings.ReplaceAll(segment, "+", "%20")
105
}
106
107
urlPath := strings.Join(encodedSegments, "/")
0 commit comments