Skip to content

Commit e8a77bd

Browse files
committed
Catch metadata updates from RBF on Box Sync (fix)
Prior to this commit, Deep Box Sync didn't catch RemoteBox File Metadata updates. Now works fine.
1 parent 5722bbc commit e8a77bd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tgbox/api/local.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from os import PathLike
1414
from io import BytesIO
1515
from time import time
16+
from traceback import format_exc
1617

1718
from inspect import isasyncgen
1819
from asyncio import iscoroutinefunction, gather
@@ -2086,6 +2087,22 @@ async def import_file(
20862087
pf.set_file_id(drbf._id)
20872088
pf.set_upload_time(drbf._upload_time)
20882089

2090+
updated_metadata = None
2091+
if drbf._message.message:
2092+
try:
2093+
caption_metadata = urlsafe_b64decode(drbf._message.message)
2094+
_ = AES(drbf._filekey).decrypt(caption_metadata)
2095+
_ = PackedAttributes.unpack(_)
2096+
updated_metadata = caption_metadata
2097+
except Exception as e:
2098+
logger.info(
2099+
f'Updates to metadata for ID{drbf._id} failed. '
2100+
f'Traceback:\n{format_exc()}'
2101+
)
2102+
2103+
if updated_metadata:
2104+
pf.set_updated_enc_metadata(caption_metadata)
2105+
20892106
dlbf = await self._make_local_file(pf)
20902107

20912108
if update_metadata:

0 commit comments

Comments
 (0)