dev@locazia: fix indexation

This commit is contained in:
user committed 2024-03-08 19:48:41 +03:00
1 parent b4b7a878f4
commit cc8b830260
2 files changed
+11 -3

No files matched your search

+4 -2
View File
@@ -1,5 +1,4 @@
from base58 import b58encode, b58decode
import math
from tonsdk.boc import begin_cell
from app.core._config import ALLOWED_CONTENT_TYPES
@@ -45,7 +44,10 @@ class ContentId:
)
if not (self.safe_onchain_index is None):
oi_bin_hex = hex(self.safe_onchain_index)[2:]
oi_bin_len = math.ceil(len(oi_bin_hex) / 2)
if len(oi_bin_hex) % 2:
oi_bin_hex = '0' + oi_bin_hex
oi_bin_len = len(oi_bin_hex) / 2
cid_bin += b'\xb0' + oi_bin_len.to_bytes(1, 'big') + bytes.fromhex(oi_bin_hex)
if self.accept_type and include_accept_type:
at_bin_len = len(self.accept_type.encode())