mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
drive: rewrite Location headers
This ensures that MOVE, LOCK and any other verbs that use the Location header work correctly. Fixes #11758 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:

committed by
Percy Wegmann

parent
c24f2eee34
commit
787f8c08ec
@@ -4,6 +4,7 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
@@ -35,6 +36,16 @@ func Join(parts ...string) string {
|
||||
return path.Join(fullParts...)
|
||||
}
|
||||
|
||||
// JoinEscaped is like Join but path escapes each part.
|
||||
func JoinEscaped(parts ...string) string {
|
||||
fullParts := make([]string, 0, len(parts))
|
||||
fullParts = append(fullParts, sepString)
|
||||
for _, part := range parts {
|
||||
fullParts = append(fullParts, url.PathEscape(part))
|
||||
}
|
||||
return path.Join(fullParts...)
|
||||
}
|
||||
|
||||
// IsRoot determines whether a given path p is the root path, defined as either
|
||||
// empty or "/".
|
||||
func IsRoot(p string) bool {
|
||||
|
Reference in New Issue
Block a user