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:
Percy Wegmann
2024-04-18 12:11:20 -05:00
committed by Percy Wegmann
parent c24f2eee34
commit 787f8c08ec
4 changed files with 52 additions and 8 deletions

View File

@@ -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 {