dev@locazia: fix encrypt content
This commit is contained in:
1 parent
b8251a456b
commit
e00a25f713
2 files changed
+41
-28
No files matched your search
@@ -10,6 +10,7 @@ from app.core._config import UPLOADS_DIR
|
||||
from app.core._crypto.cipher import AESCipher
|
||||
from app.core.models.keys import KnownKey
|
||||
from app.core.models.node_storage import StoredContent
|
||||
from app.core.logger import make_log
|
||||
|
||||
|
||||
async def create_new_encryption_key(db_session, user_id: int = None) -> KnownKey:
|
||||
@@ -48,6 +49,7 @@ async def create_encrypted_content(
|
||||
StoredContent.id == decrypted_content.id
|
||||
).first()
|
||||
if encrypted_content:
|
||||
make_log("create_encrypted_content", f"(d={decrypted_content.cid.serialize_v2()}) => (e={encrypted_content.cid.serialize_v2()}): already exist (found by decrypted content)", level="debug")
|
||||
return encrypted_content
|
||||
|
||||
encrypted_content = None
|
||||
@@ -74,6 +76,7 @@ async def create_encrypted_content(
|
||||
StoredContent.hash == encrypted_hash
|
||||
).first()
|
||||
if encrypted_content:
|
||||
make_log("create_encrypted_content", f"(d={decrypted_content.cid.serialize_v2()}) => (e={encrypted_content.cid.serialize_v2()}): already exist (found by encrypted_hash)", level="debug")
|
||||
return encrypted_content
|
||||
|
||||
encrypted_content = None
|
||||
@@ -106,6 +109,7 @@ async def create_encrypted_content(
|
||||
StoredContent.hash == encrypted_hash
|
||||
).first()
|
||||
assert encrypted_content, "Content not created"
|
||||
make_log("create_encrypted_content", f"(d={decrypted_content.cid.serialize_v2()}) => (e={encrypted_content.cid.serialize_v2()}): created new content/bin", level="debug")
|
||||
return encrypted_content
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user