diff options
Diffstat (limited to 'qutebrowser/completion/models/filepathcategory.py')
-rw-r--r-- | qutebrowser/completion/models/filepathcategory.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qutebrowser/completion/models/filepathcategory.py b/qutebrowser/completion/models/filepathcategory.py index ac5dd2278..f9b6608a3 100644 --- a/qutebrowser/completion/models/filepathcategory.py +++ b/qutebrowser/completion/models/filepathcategory.py @@ -91,7 +91,13 @@ class FilePathCategory(QAbstractListModel): for path in self._glob(url_path) ) else: - paths = self._glob(os.path.expanduser(val)) + try: + expanded = os.path.expanduser(val) + except UnicodeEncodeError: + # os.path.expanduser('~\ud800') can raise UnicodeEncodeError + # via pwd.getpwnam + expanded = val + paths = self._glob(expanded) self._paths = sorted(self._contract_user(val, path) for path in paths) def data(self, index: QModelIndex, role: int = Qt.DisplayRole) -> Optional[str]: |