Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
9e9e94b8 by wurstsalat at 2025-02-21T23:23:24+01:00
cfix: Preview: Fix signature and error logging; add assertions

- - - - -


1 changed file:

- gajim/common/preview.py


Changes:

=====================================
gajim/common/preview.py
=====================================
@@ -357,15 +357,16 @@ def create_thumbnail(self, preview: Preview, data: bytes) 
-> None:
             callback=partial(self._write_thumbnail, preview),
         )
 
-    def _write_thumbnail(self, preview: Preview, data: bytes) -> None:
+    def _write_thumbnail(self, preview: Preview, data: bytes | None) -> None:
         if data is None:
             preview.info_message = _('Creating thumbnail failed')
             preview.update_widget()
-            log.warning('Creating thumbnail failed for: %s', self.orig_path)
+            log.warning('Creating thumbnail failed for: %s', preview.orig_path)
             return
 
         preview.thumbnail = data
 
+        assert preview.thumb_path is not None
         write_file_async(preview.thumb_path,
                          preview.thumbnail,
                          self._on_thumb_write_finished,
@@ -550,6 +551,7 @@ def _on_finished(self, request: HTTPRequest) -> None:
             if preview.orig_path is not None:
                 preview.mime_type = guess_mime_type(preview.orig_path, data)
 
+        assert preview.orig_path is not None
         write_file_async(preview.orig_path,
                          data,
                          self._on_orig_write_finished,



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/9e9e94b8d0793271680f273678a02a6d9370a7f2

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to