fix(documents): normalize UUID to undashed hex in raw SQL quota UPDATE

str(uuid) returns dashed format (xxxx-xxxx-…) which mismatches SQLite's
CHAR(32) storage (undashed hex). Replace with .replace('-', '') so the
WHERE clause matches in both SQLite (tests) and PostgreSQL (production).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-05-30 18:57:02 +02:00
parent bd765f69bf
commit bf7d86184d
+2 -2
View File
@@ -345,7 +345,7 @@ async def confirm_upload(
" AND (used_bytes + :delta) <= limit_bytes "
"RETURNING used_bytes, limit_bytes"
),
{"delta": size, "uid": str(doc.user_id)},
{"delta": size, "uid": str(doc.user_id).replace("-", "")},
)
row = result.fetchone()
@@ -353,7 +353,7 @@ async def confirm_upload(
# Quota exceeded — fetch current quota state for the 413 body
quota_result = await session.execute(
text("SELECT used_bytes, limit_bytes FROM quotas WHERE user_id = :uid"),
{"uid": str(doc.user_id)},
{"uid": str(doc.user_id).replace("-", "")},
)
q = quota_result.fetchone()
# Delete the pending Document row and best-effort remove the MinIO object