Philipp Hörist pushed to branch master at gajim / gajim


Commits:
9497dce2 by Philipp Hörist at 2019-12-21T21:54:52Z
Don't clean up temp file to early

We have to preserve it until the file transfer is finished

- - - - -


1 changed file:

- gajim/chat_control_base.py


Changes:

=====================================
gajim/chat_control_base.py
=====================================
@@ -26,7 +26,7 @@
 import os
 import time
 import uuid
-from tempfile import TemporaryDirectory
+import tempfile
 
 from gi.repository import Gtk
 from gi.repository import Gdk
@@ -793,15 +793,12 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, 
EventHelper):
         if is_checked:
             app.config.set('confirm_paste_image', False)
 
-        tmp_dir = TemporaryDirectory()
-        dir_ = tmp_dir.name
-        path = os.path.join(dir_, '0.png')
+        dir_ = tempfile.gettempdir()
+        path = os.path.join(dir_, '%s.png' % str(uuid.uuid4()))
         image.savev(path, 'png', [], [])
 
         self._start_filetransfer(path)
 
-        tmp_dir.cleanup()
-
     def _get_pref_ft_method(self):
         ft_pref = app.config.get_per('accounts', self.account,
                                      'filetransfer_preference')



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/9497dce25d432d67919d35b0f17fa18b6c0b47dc

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/9497dce25d432d67919d35b0f17fa18b6c0b47dc
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to