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


Commits:
d766242b by wurstsalat at 2025-11-12T19:59:29+01:00
fix: Manage roster: Catch permission errors on export

Fixes #12532

- - - - -


1 changed file:

- gajim/gtk/preference/manage_roster.py


Changes:

=====================================
gajim/gtk/preference/manage_roster.py
=====================================
@@ -454,10 +454,15 @@ def _on_file_picked(dialog: Gtk.FileDialog, result: 
Gio.AsyncResult) -> None:
         dialog.save(parent, None, _on_file_picked)
 
     def _export(self, path: Path) -> None:
-        with path.open(mode="w", encoding="utf-8") as csvfile:
-            writer = csv.writer(csvfile)
-            for jid, item in self._client.get_module("Roster").iter():
-                writer.writerow([jid, item.name, ";".join(item.groups)])
+        try:
+            with path.open(mode="w", encoding="utf-8") as csvfile:
+                writer = csv.writer(csvfile)
+                for jid, item in self._client.get_module("Roster").iter():
+                    writer.writerow([jid, item.name, ";".join(item.groups)])
+        except PermissionError:
+            InformationAlertDialog(
+                _("Export Error"), _("No permission to export file to %s") % 
path.parent
+            )
 
     def _import(self, path: Path) -> None:
         jids = {str(jid) for jid, _item in 
self._client.get_module("Roster").iter()}



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/d766242bc8be75b81b8ff98d35d52abcab8a2c6a
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