Skip to content

Commit f7c5f6a

Browse files
committed
chore: check if remote size is same as local file when downloading
1 parent ef82807 commit f7c5f6a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pysus/api/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ async def download(
253253

254254
existing_local = await self.get_local_file(file)
255255
if existing_local and existing_local.path.exists():
256-
return existing_local
256+
if existing_local.size == file.size:
257+
return existing_local
258+
await self._delete_record(str(existing_local.path))
259+
existing_local.path.unlink(missing_ok=True)
257260

258261
client_name = file.client.name.lower()
259262
remote_path = file.path

0 commit comments

Comments
 (0)