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


Commits:
406f19fa by wurstsalat at 2026-01-13T20:47:14+01:00
fix: ManageRoster: Catch errors when trying to import unsuitable files

Fixes #12594

- - - - -


1 changed file:

- gajim/gtk/preference/manage_roster.py


Changes:

=====================================
gajim/gtk/preference/manage_roster.py
=====================================
@@ -463,13 +463,22 @@ def _import(self, path: Path) -> None:
         items: list[ImportedItem] = []
         with path.open(encoding="utf-8") as csvfile:
             reader = csv.reader(csvfile, strict=True)
-            for row in reader:
-                if row[CSVColumn.JID] in jids:
-                    continue
-
-                item = self._validate_imported_item(row)
-                if item is not None:
-                    items.append(item)
+            try:
+                for row in reader:
+                    if row[CSVColumn.JID] in jids:
+                        continue
+
+                    item = self._validate_imported_item(row)
+                    if item is not None:
+                        items.append(item)
+            except Exception:
+                log.error("Could not read file %s to import roster contacts", 
path.name)
+                InformationAlertDialog(
+                    _("Import Error"),
+                    _("Could not read content of %s. Only CSV files can be 
imported.")
+                    % path.name,
+                )
+                return
 
         if not items:
             InformationAlertDialog(_("Import Error"), _("No contacts found to 
import"))



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

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