util: Add a bunch of tests
This improves our test coverage significantly.
This commit is contained in:
committed by
James Shubin
parent
ae68dd79cb
commit
c5d7fdb0a3
@@ -296,6 +296,9 @@ loop:
|
||||
// SafePathClean does path.Clean, but it preserves any trailing slash if it was
|
||||
// present in the initial path.
|
||||
func SafePathClean(s string) string {
|
||||
if s == "/" {
|
||||
return "/"
|
||||
}
|
||||
hasSlash := strings.HasSuffix(s, "/")
|
||||
clean := path.Clean(s) // removes trailing slashes
|
||||
if hasSlash { // add it back if it was taken off
|
||||
|
||||
Reference in New Issue
Block a user