|
|
|
@ -135,6 +135,12 @@ func joinSanitizedPaths(start, end string) string {
|
|
|
|
|
end = ""
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
// Trim any leading '/'
|
|
|
|
|
if end[0] == '/' {
|
|
|
|
|
end = end[1:]
|
|
|
|
|
endLen--
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Trim any trailing '/'
|
|
|
|
|
if end[endLen-1] == '/' {
|
|
|
|
|
end = end[:endLen-1]
|
|
|
|
@ -148,13 +154,12 @@ func joinSanitizedPaths(start, end string) string {
|
|
|
|
|
case "/":
|
|
|
|
|
return start + end
|
|
|
|
|
default:
|
|
|
|
|
// Ensure no final '/'
|
|
|
|
|
length := len(start)
|
|
|
|
|
if start[length-1] == '/' {
|
|
|
|
|
start = start[:length-1]
|
|
|
|
|
// Ensure there is a path separator
|
|
|
|
|
// between the final path component of
|
|
|
|
|
// start, and the beginning of end
|
|
|
|
|
if start[len(start)-1] == '/' {
|
|
|
|
|
return start + end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return joined strings
|
|
|
|
|
return start + "/" + end
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|