Preserve tailing backslash in URL paths (#7678)

Fixes #7649
This commit is contained in:
Praveen raj Mani
2019-07-26 09:25:09 +05:30
committed by kannappanr
parent d744865dc6
commit efb8b00db0
2 changed files with 9 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import (
"errors"
"net/url"
"path"
"strings"
)
// URL - improved JSON friendly url.URL.
@@ -100,6 +101,11 @@ func ParseURL(s string) (u *URL, err error) {
uu.Path = path.Clean(uu.Path)
}
// path.Clean removes the trailing '/' and converts '//' to '/'.
if strings.HasSuffix(s, "/") && !strings.HasSuffix(uu.Path, "/") {
uu.Path += "/"
}
v := URL(*uu)
u = &v
return u, nil