Skip to content

Commit e9e9dc8

Browse files
committed
Issue #108172: substring search makes no sense
When checking if the registering browser is the "OS preferred browser", do not use a substring search - that makes no sense: one can have a preferred browser that looks like a super-string of a known browser, e.g. "firefox-nightly" vs "firefox".
1 parent 3531ea4 commit e9e9dc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def register(name, klass, instance=None, *, preferred=False):
2929
# Preferred browsers go to the front of the list.
3030
# Need to match to the default browser returned by xdg-settings, which
3131
# may be of the form e.g. "firefox.desktop".
32-
if preferred or (_os_preferred_browser and name in _os_preferred_browser):
32+
if preferred or (_os_preferred_browser and f'{name}.desktop' == _os_preferred_browser):
3333
_tryorder.insert(0, name)
3434
else:
3535
_tryorder.append(name)

0 commit comments

Comments
 (0)