fix: make DELETE idempotent — return 200 for already-deleted memories
Old sync clients without 404 handling get stuck in infinite retry loops when trying to delete an already-deleted memory. Making the endpoint idempotent (returning success regardless) fixes this for all existing clients without requiring client upgrades.
This commit is contained in:
parent
b6869ef496
commit
6aa4d31170
1 changed files with 3 additions and 1 deletions
|
|
@ -260,7 +260,9 @@ async def delete_memory(memory_id: int, user: AuthUser = Depends(get_current_use
|
|||
user.user_id,
|
||||
)
|
||||
if not row:
|
||||
raise HTTPException(status_code=404, detail="Memory not found")
|
||||
# Idempotent: return success even if already deleted
|
||||
# Prevents old clients without 404-handling from infinite retry loops
|
||||
return {"deleted": memory_id, "preview": "[already deleted]"}
|
||||
|
||||
if row["vault_path"]:
|
||||
await delete_secret(user.user_id, row["vault_path"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue