diff --git a/app/api/routes/_blockchain.py b/app/api/routes/_blockchain.py index bb7881a..6c9e13b 100644 --- a/app/api/routes/_blockchain.py +++ b/app/api/routes/_blockchain.py @@ -77,7 +77,7 @@ async def s_api_v1_blockchain_send_new_content_message(request): metadata_content = await create_metadata_for_item( request.ctx.db_session, - title=f"{', '.join(request.json['authors'])} - {request.json['title']}", + title=f"{', '.join(request.json['authors'])} - {request.json['title']}" if request.json['authors'] else request.json['title'], cover_url=f"{PROJECT_HOST}/api/v1/storage/{image_content_cid.serialize_v2()}" if image_content_cid else None, authors=request.json['authors'] ) diff --git a/app/api/routes/node_storage.py b/app/api/routes/node_storage.py index 56898ee..ab57a38 100644 --- a/app/api/routes/node_storage.py +++ b/app/api/routes/node_storage.py @@ -109,14 +109,14 @@ async def s_api_v1_storage_get(request, file_hash=None): content_file_bin = await file.read() accept_type = cid.accept_type or request.headers.get("Accept") - accept_type = accept_type or "application/octet-stream" + accept_type = accept_type or content.meta.get("content_type") if accept_type: if accept_type == "application/json": return response.json( json.loads(content_file_bin.decode()) ) - return response.raw(body=content_file_bin, content_type=accept_type) + return response.raw(body=content_file_bin, **({'content_type': accept_type} if accept_type else {})) async def s_api_v1_storage_decode_cid(request, content_id=None):