fix: archive by hash workspace specificity

This commit is contained in:
Ruben Fiszel
2025-09-11 18:01:52 +00:00
parent e6a7dc265d
commit f0c3d82077
2 changed files with 3 additions and 2 deletions
@@ -15,7 +15,7 @@
]
},
"nullable": [
true
null
]
},
"hash": "5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55"
+2 -1
View File
@@ -1796,9 +1796,10 @@ async fn archive_script_by_hash(
let mut tx = user_db.begin(&authed).await?;
let script = sqlx::query_as::<_, Script>(
"UPDATE script SET archived = true WHERE hash = $1 RETURNING *",
"UPDATE script SET archived = true WHERE hash = $1 AND workspace_id = $2 RETURNING *",
)
.bind(&hash.0)
.bind(&w_id)
.fetch_one(&mut *tx)
.await
.map_err(|e| Error::internal_err(format!("archiving script in {w_id}: {e:#}")))?;