Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle empty command lines - catapult will break if a distribution ha…
…s desktop files with empty command-lines (#32) * Handle empty command lines - catapult will break if a distribution has desktop files with empty command-lines Example: ``` 08:49:12 DEBUG: AppsPlugin: 569 items in index 08:49:12 DEBUG: AppsPlugin: 569 items in index 08:49:16 DEBUG: AppsPlugin: Updating index... 08:49:16 DEBUG: AppsPlugin: 569 items in index 08:49:17 DEBUG: SearchManager: Starting search for 'q' 08:49:17 DEBUG: AppsPlugin: Found qemu.desktop for 'q' 08:49:17 ERROR: Failed to get search results from apps Traceback (most recent call last): File "/tmp/catapult-devel.git/catapult/search.py", line 59, in _get_results for i, result in enumerate(plugin.search(query)): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/catapult-devel.git/catapult/plugins/apps.py", line 99, in search description=self._get_description(app), ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/catapult-devel.git/catapult/plugins/apps.py", line 61, in _get_description description = re.sub(r" %\w\b", "", description) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/re/__init__.py", line 186, in sub return _compile(pattern, flags).sub(repl, string, count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected string or bytes-like object, got 'NoneType' 08:49:17 DEBUG: SearchManager: builtins delivered in 0 ms 08:49:17 DEBUG: SearchManager: Found 0 results 08:49:17 DEBUG: SearchManager: Adjusted scores in 0 ms ``` * Move condition to indexing --------- Co-authored-by: Osmo Salomaa <otsaloma@iki.fi>
- Loading branch information