dev@locazia: fix cover upload
This commit is contained in:
parent
c7506547ab
commit
7c5bdb3bb6
|
|
@ -55,12 +55,16 @@ async def s_api_v1_blockchain_send_new_content_message(request):
|
||||||
assert encrypted_content, "No content locally found"
|
assert encrypted_content, "No content locally found"
|
||||||
assert encrypted_content.type == "local/content_bin", "Invalid content type"
|
assert encrypted_content.type == "local/content_bin", "Invalid content type"
|
||||||
|
|
||||||
image_content_cid, err = resolve_content(request.json['image'])
|
if request.json['image']:
|
||||||
assert not err, f"Invalid image CID"
|
image_content_cid, err = resolve_content(request.json['image'])
|
||||||
image_content = request.ctx.db_session.query(StoredContent).filter(
|
assert not err, f"Invalid image CID"
|
||||||
StoredContent.hash == image_content_cid.content_hash_b58
|
image_content = request.ctx.db_session.query(StoredContent).filter(
|
||||||
).first()
|
StoredContent.hash == image_content_cid.content_hash_b58
|
||||||
assert image_content, "No image locally found"
|
).first()
|
||||||
|
assert image_content, "No image locally found"
|
||||||
|
else:
|
||||||
|
image_content_cid = None
|
||||||
|
image_content = None
|
||||||
|
|
||||||
metadata_content = await create_metadata_for_item(
|
metadata_content = await create_metadata_for_item(
|
||||||
request.ctx.db_session,
|
request.ctx.db_session,
|
||||||
|
|
@ -114,7 +118,7 @@ async def s_api_v1_blockchain_send_new_content_message(request):
|
||||||
.store_ref(
|
.store_ref(
|
||||||
begin_cell()
|
begin_cell()
|
||||||
.store_ref(begin_cell().store_bytes(f"{encrypted_content_cid.serialize_v1()}".encode()).end_cell())
|
.store_ref(begin_cell().store_bytes(f"{encrypted_content_cid.serialize_v1()}".encode()).end_cell())
|
||||||
.store_ref(begin_cell().store_bytes(f"{image_content_cid.serialize_v1()}".encode()).end_cell())
|
.store_ref(begin_cell().store_bytes(f"{image_content_cid.serialize_v1() if image_content_cid else ''}".encode()).end_cell())
|
||||||
.store_ref(begin_cell().store_bytes(f"{metadata_content.serialize_v1()}".encode()).end_cell())
|
.store_ref(begin_cell().store_bytes(f"{metadata_content.serialize_v1()}".encode()).end_cell())
|
||||||
.end_cell()
|
.end_cell()
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue