FIX: Remove unused variables in move handler
This commit is contained in:
@@ -1294,12 +1294,6 @@ func moveOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get source file details from database
|
|
||||||
sourceFile, err := db.GetFileByID(r.Context(), uuid.Nil) // First get by path - need to implement or use different approach
|
|
||||||
if err != nil {
|
|
||||||
// For now, just move in Nextcloud and delete old record, create new
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get or create user's WebDAV client and move in Nextcloud
|
// Get or create user's WebDAV client and move in Nextcloud
|
||||||
storageClient, err := getUserWebDAVClient(r.Context(), db, userID, cfg.NextcloudURL, cfg.NextcloudUser, cfg.NextcloudPass)
|
storageClient, err := getUserWebDAVClient(r.Context(), db, userID, cfg.NextcloudURL, cfg.NextcloudUser, cfg.NextcloudPass)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1314,18 +1308,7 @@ func moveOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update file path in database
|
// Delete old file record from database - next sync will recreate with new path
|
||||||
var newPath string
|
|
||||||
if strings.HasSuffix(req.TargetPath, "/") {
|
|
||||||
// Moving into a folder
|
|
||||||
newPath = path.Join(req.TargetPath, path.Base(req.SourcePath))
|
|
||||||
} else {
|
|
||||||
// Moving/renaming to a specific path
|
|
||||||
newPath = req.TargetPath
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the database by deleting old and creating new, or just update path
|
|
||||||
// Since there's no UpdateFile method, we'll delete old and let the next sync create new
|
|
||||||
if err := db.DeleteFileByPath(r.Context(), &orgID, nil, req.SourcePath); err != nil {
|
if err := db.DeleteFileByPath(r.Context(), &orgID, nil, req.SourcePath); err != nil {
|
||||||
errors.LogError(r, err, "Failed to delete old file record")
|
errors.LogError(r, err, "Failed to delete old file record")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user