aboutsummaryrefslogtreecommitdiffstats
path: root/community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch')
-rw-r--r--community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch b/community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch
new file mode 100644
index 0000000000..f41e46d37d
--- /dev/null
+++ b/community/portfolio/0001-places-handle-cases-where-XDG_-dirs-couldnt-be-resolve.patch
@@ -0,0 +1,60 @@
+From c3a336d94fd6da0dcbb7fdaa2410d88aea18c1f2 Mon Sep 17 00:00:00 2001
+From: Clayton Craft <clayton@craftyguy.net>
+Date: Wed, 3 Mar 2021 12:54:19 -0800
+Subject: [PATCH] places: handle cases where XDG_ dirs couldn't be resolved
+
+get_user_special_dirs can return None if the logical id could not be
+resolved, so this change handles this case by skipping over the call to
+_add_place.
+
+Without this check, the application will crash with a TypeError when it
+ultimately calls os.fspath(None).
+---
+ src/places.py | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/places.py b/src/places.py
+index 1cbbbe6..de6257c 100644
+--- a/src/places.py
++++ b/src/places.py
+@@ -95,35 +95,35 @@ def _setup(self):
+ _("Home"),
+ self.PORTFOLIO_HOME_DIR,
+ )
+- if self._has_permission_for(self.DOWNLOAD_PERMISSION):
++ if self._has_permission_for(self.DOWNLOAD_PERMISSION) and self.XDG_DOWNLOAD:
+ self._add_place(
+ self._places_group,
+ "folder-download-symbolic",
+ os.path.basename(self.XDG_DOWNLOAD),
+ self.XDG_DOWNLOAD,
+ )
+- if self._has_permission_for(self.DOCUMENTS_PERMISSION):
++ if self._has_permission_for(self.DOCUMENTS_PERMISSION) and self.XDG_DOCUMENTS:
+ self._add_place(
+ self._places_group,
+ "folder-documents-symbolic",
+ os.path.basename(self.XDG_DOCUMENTS),
+ self.XDG_DOCUMENTS,
+ )
+- if self._has_permission_for(self.PICTURES_PERMISSION):
++ if self._has_permission_for(self.PICTURES_PERMISSION) and self.XDG_PICTURES:
+ self._add_place(
+ self._places_group,
+ "folder-pictures-symbolic",
+ os.path.basename(self.XDG_PICTURES),
+ self.XDG_PICTURES,
+ )
+- if self._has_permission_for(self.MUSIC_PERMISSION):
++ if self._has_permission_for(self.MUSIC_PERMISSION) and self.XDG_MUSIC:
+ self._add_place(
+ self._places_group,
+ "folder-music-symbolic",
+ os.path.basename(self.XDG_MUSIC),
+ self.XDG_MUSIC,
+ )
+- if self._has_permission_for(self.VIDEOS_PERMISSION):
++ if self._has_permission_for(self.VIDEOS_PERMISSION) and self.XDG_VIDEOS:
+ self._add_place(
+ self._places_group,
+ "folder-videos-symbolic",