fix metadata
This commit is contained in:
parent
66cef7836d
commit
67a8df3b52
|
|
@ -163,7 +163,7 @@ async def s_api_v1_blockchain_send_purchase_content_message(request):
|
||||||
|
|
||||||
for field_key, field_value in {
|
for field_key, field_value in {
|
||||||
'content_address': lambda x: isinstance(x, str),
|
'content_address': lambda x: isinstance(x, str),
|
||||||
'price': lambda x: (isinstance(x, str) and x.isdigit()),
|
# 'price': lambda x: (isinstance(x, str) and x.isdigit()),
|
||||||
}.items():
|
}.items():
|
||||||
assert field_key in request.json, f"No {field_key} provided"
|
assert field_key in request.json, f"No {field_key} provided"
|
||||||
assert field_value(request.json[field_key]), f"Invalid {field_key} provided"
|
assert field_value(request.json[field_key]), f"Invalid {field_key} provided"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from app.core.logger import make_log
|
||||||
from app.core.models.node_storage import StoredContent
|
from app.core.models.node_storage import StoredContent
|
||||||
from app.core.models.keys import KnownKey
|
from app.core.models.keys import KnownKey
|
||||||
from app.core.models.content.user_content import UserContent
|
from app.core.models.content.user_content import UserContent
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
async def s_api_v1_content_list(request):
|
async def s_api_v1_content_list(request):
|
||||||
|
|
@ -56,6 +57,13 @@ async def s_api_v1_content_view(request, content_address: str):
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content_meta = content['encrypted_content'].json_format()
|
||||||
|
content_metadata = StoredContent.from_cid(request.ctx.db_session, content_meta.get('metadata_cid') or None)
|
||||||
|
with open(content_metadata.filepath, 'r') as f:
|
||||||
|
content_metadata_json = json.loads(f.read())
|
||||||
|
|
||||||
|
display_options['metadata'] = content_metadata_json
|
||||||
|
|
||||||
return response.json({
|
return response.json({
|
||||||
**opts,
|
**opts,
|
||||||
'encrypted': content['encrypted_content'].json_format(),
|
'encrypted': content['encrypted_content'].json_format(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue