MCPcopy
hub / github.com/AlistGo/alist / ResolvePath

Function ResolvePath

server/webdav/path.go:13–22  ·  view source on GitHub ↗

ResolvePath normalizes the provided raw path and resolves it against the user's base path before delegating to the user-aware JoinPath permission checks.

(user *model.User, raw string)

Source from the content-addressed store, hash-verified

11// ResolvePath normalizes the provided raw path and resolves it against the user's base path
12// before delegating to the user-aware JoinPath permission checks.
13func ResolvePath(user *model.User, raw string) (string, error) {
14 cleaned := utils.FixAndCleanPath(raw)
15 basePath := utils.FixAndCleanPath(user.BasePath)
16
17 if cleaned != "/" && basePath != "/" && !utils.IsSubPath(basePath, cleaned) {
18 cleaned = path.Join(basePath, strings.TrimPrefix(cleaned, "/"))
19 }
20
21 return user.JoinPath(cleaned)
22}

Callers 10

WebDAVAuthFunction · 0.92
handleOptionsMethod · 0.85
handleGetHeadPostMethod · 0.85
handleDeleteMethod · 0.85
handlePutMethod · 0.85
handleMkcolMethod · 0.85
handleCopyMoveMethod · 0.85
handleLockMethod · 0.85
handlePropfindMethod · 0.85
handleProppatchMethod · 0.85

Calls 3

FixAndCleanPathFunction · 0.92
IsSubPathFunction · 0.92
JoinPathMethod · 0.80

Tested by

no test coverage detected