diff --git a/routers/exam/templates.py b/routers/exam/templates.py index 4ea2f58..adaa931 100644 --- a/routers/exam/templates.py +++ b/routers/exam/templates.py @@ -167,8 +167,12 @@ async def _upload_template_source_file( file_id = str(uuid.uuid4()) safe_name = os.path.basename(upload.filename or "template.pdf") - bucket = f"cc.institutes.{institute_id}.private" if institute_id else SOURCE_BUCKET_FALLBACK - storage_path = f"exam-marker/{cabinet_id}/{file_id}/{safe_name}" + # Use the shared users bucket (exists on all envs). Per-institute private buckets + # (cc.institutes..private) are a future multi-tenant provisioning concern and are NOT + # created on dev .94 — using one here failed with "Bucket not found". The institute is already + # namespaced in the storage path + enforced by RLS on the files row. + bucket = SOURCE_BUCKET_FALLBACK + storage_path = f"exam-marker/{institute_id or 'noinst'}/{cabinet_id}/{file_id}/{safe_name}" try: storage.upload_file(bucket, storage_path, file_bytes, "application/pdf", upsert=True)