Refactor moveUserFileHandler to store user files directly in WebDAV root, removing unnecessary path prefix

This commit is contained in:
Leon Bösche
2026-01-13 22:31:58 +01:00
parent c00c1e273d
commit 847a8de414

View File

@@ -1640,10 +1640,9 @@ func moveUserFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB
if err != nil {
errors.LogError(r, err, "Failed to get user WebDAV client (continuing with database operation)")
} else {
sourceRel := strings.TrimPrefix(req.SourcePath, "/")
sourcePath := path.Join("/users", userID.String(), sourceRel)
targetRel := strings.TrimPrefix(newPath, "/")
targetPath := path.Join("/users", userID.String(), targetRel)
// User files are stored directly in the user's WebDAV root (no /users/{id} prefix)
sourcePath := "/" + strings.TrimPrefix(req.SourcePath, "/")
targetPath := "/" + strings.TrimPrefix(newPath, "/")
if err := storageClient.Move(r.Context(), sourcePath, targetPath); err != nil {
errors.LogError(r, err, "Failed to move in Nextcloud (continuing with database operation)")
}