dev@locazia: try storage routing

This commit is contained in:
user 2024-03-10 01:29:18 +03:00
parent ed88a38cd9
commit 01d56dae42
1 changed files with 2 additions and 1 deletions

View File

@ -98,9 +98,10 @@ async def s_api_v1_storage_get(request, file_hash=None):
if not content:
return response.json({"error": "File not found"}, status=404)
make_log("Storage", f"File {content_sha256} requested by {request.ip}")
make_log("Storage", f"File {content_sha256} requested by {request.ctx.user}")
file_path = os.path.join(UPLOADS_DIR, content_sha256)
if not os.path.exists(file_path):
make_log("Storage", f"File {content_sha256} not found locally", level="error")
return response.json({"error": "File not found"}, status=404)
return await response.file(file_path)