Refactor moveUserFileHandler to store user files directly in WebDAV root, removing unnecessary path prefix
This commit is contained in:
@@ -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)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user