fix(desktop-file): verify theme icons before rewriting icon - #6374
Open
soumyaDghosh wants to merge 1 commit into
Open
fix(desktop-file): verify theme icons before rewriting icon#6374soumyaDghosh wants to merge 1 commit into
soumyaDghosh wants to merge 1 commit into
Conversation
Theme-resolved icon path was written to the desktop file without checking the file exists, and the subsequent existence check ran against the bare icon name stored in `icon` variable, emitting a spurious "not found" warning. Assign the resolved path to the local var first so the same check covers theme icons. Signed-off-by: Soumyadeep Ghosh <soumyadeepghosh2004@zohomail.in>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect “Icon not found” warnings when a desktop file’s Icon= value is a theme icon name that gets resolved from the hicolor theme during desktop file rewriting (Fixes #6364).
Changes:
- Update theme icon resolution logic to assign the resolved theme path to the local
iconvariable (so the subsequent existence check validates the resolved path). - Avoid writing the theme-resolved
${SNAP}/…icon path into the desktop file before the file existence check has passed.
Comment on lines
+101
to
+105
| theme_icon_path := get_icon_from_theme( | ||
| os.fspath(self._prime_dir), "hicolor", icon | ||
| ) | ||
| ) is not None: | ||
| self._parser[section]["Icon"] = os.path.join("${SNAP}", icon_path) | ||
| icon = theme_icon_path |
Comment on lines
99
to
103
| if "/" not in icon: | ||
| if ( | ||
| icon_path := get_icon_from_theme( | ||
| theme_icon_path := get_icon_from_theme( | ||
| os.fspath(self._prime_dir), "hicolor", icon | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Theme-resolved icon path was written to the desktop file without checking the file exists, and the subsequent existence check ran against the bare icon name stored in
iconvariable, emitting a spurious "not found" warning. Assign the resolved path to the local var first so the same check covers theme icons.Fixes #6364
IMO, this complete function should be refactored, including early return when icon is None, converting these 2 lines into a single one liner and remove any prefixed
$SNAPas wellmake lint && make test.