diff --git a/client.py b/client.py index 95cba17..0bccdd3 100755 --- a/client.py +++ b/client.py @@ -13,6 +13,7 @@ from random import randint from shutil import rmtree from threading import Thread from time import sleep +from uuid import uuid4 from PIL import Image, ImageTk from requests import post @@ -182,8 +183,12 @@ class MunyalClient(Icon): directory = os.path.split(full_path)[0] if not os.path.exists(directory): os.makedirs(directory, exist_ok=True) - with open(full_path, "wb") as f: + directory, _ = os.path.split(full_path) + temp_name = str(uuid4()) + ".tmp" + temp_dir = path_join(directory, temp_name) + with open(temp_dir, "wb") as f: f.write(base64.b85decode(data["file"].encode("ascii"))) + os.rename(temp_dir, full_path) else: os.remove(full_path) else: @@ -192,7 +197,6 @@ class MunyalClient(Icon): else: shutil.rmtree(full_path) - def __download(self, message): try: data = json.loads(message) diff --git a/img/logo.png b/img/logo.png index ab5f196..21ec4db 100644 Binary files a/img/logo.png and b/img/logo.png differ