fix: improve file listing and path handling in Webdav storage

This commit is contained in:
krau
2026-01-19 20:35:48 +08:00
parent f92c43b9c8
commit 17e340fff1

View File

@@ -129,9 +129,12 @@ func (w *Webdav) ListFiles(ctx context.Context, dirPath string) ([]storagetypes.
isDir := resp.Propstat.Prop.ResourceType.IsCollection()
filePath := strings.TrimPrefix(decodedHref, path.Join("/", strings.Trim(path.Dir(fullPath), "/")))
filePath = strings.TrimPrefix(filePath, "/")
fileInfo := storagetypes.FileInfo{
Name: name,
Path: strings.TrimPrefix(decodedHref, w.config.BasePath),
Path: path.Join(dirPath, name),
Size: resp.Propstat.Prop.GetContentLength,
IsDir: isDir,
ModTime: modTime,