diff --git a/b0esche_cloud/lib/services/file_service.dart b/b0esche_cloud/lib/services/file_service.dart index 7366c97..6780cb3 100644 --- a/b0esche_cloud/lib/services/file_service.dart +++ b/b0esche_cloud/lib/services/file_service.dart @@ -161,13 +161,11 @@ class FileService { String sourcePath, String targetPath, ) async { - final response = await apiClient.post( + await _apiClient.post( '/orgs/$orgId/files/move', data: {'sourcePath': sourcePath, 'targetPath': targetPath}, + fromJson: (d) => null, ); - if (response.statusCode != 200) { - throw Exception('Failed to move file: ${response.statusCode}'); - } } Future renameFile(String orgId, String path, String newName) async { diff --git a/go_cloud/internal/http/routes.go b/go_cloud/internal/http/routes.go index da4ee19..86bc13f 100644 --- a/go_cloud/internal/http/routes.go +++ b/go_cloud/internal/http/routes.go @@ -1297,18 +1297,18 @@ func moveOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB, // Get or create user's WebDAV client and move in Nextcloud storageClient, err := getUserWebDAVClient(r.Context(), db, userID, cfg.NextcloudURL, cfg.NextcloudUser, cfg.NextcloudPass) if err != nil { - errors.LogError(r, err, "Failed to get user WebDAV client (continuing with database move)") + errors.LogError(r, err, "Failed to get user WebDAV client (continuing with database operation)") } else { sourceRel := strings.TrimPrefix(req.SourcePath, "/") sourcePath := path.Join("/orgs", orgID.String(), sourceRel) targetRel := strings.TrimPrefix(req.TargetPath, "/") targetPath := path.Join("/orgs", orgID.String(), targetRel) if err := storageClient.Move(r.Context(), sourcePath, targetPath); err != nil { - errors.LogError(r, err, "Failed to move in Nextcloud (continuing with database move)") + errors.LogError(r, err, "Failed to move in Nextcloud (continuing with database operation)") } } - // Delete old file record from database - next sync will recreate with new path + // Delete old file record from database - file will be synced with new path from storage if err := db.DeleteFileByPath(r.Context(), &orgID, nil, req.SourcePath); err != nil { errors.LogError(r, err, "Failed to delete old file record") }