Skip to content

Commit 81ba4d5

Browse files
Greg's suggestions
1 parent 69439fd commit 81ba4d5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/test/test_webbrowser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ def test_reject_action_dash_prefixes(self):
120120
browser = self.browser_class(name=CMD_NAME)
121121
with self.assertRaises(ValueError):
122122
browser.open('%action--incognito')
123+
# new=1: action is "--new-window", so "%action" itself expands to
124+
# a dash-prefixed flag even with no dash in the original URL.
125+
with self.assertRaises(ValueError):
126+
browser.open('%action', new=1)
123127

124128

125129
class EdgeCommandTest(CommandTestMixin, unittest.TestCase):

Lib/webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def open(self, url, new=0, autoraise=True):
289289

290290
self._check_url(url.replace("%action", action))
291291

292-
args = [arg.replace("%s", url).replace("%action", action)
292+
args = [arg.replace("%action", action).replace("%s", url)
293293
for arg in self.remote_args]
294294
args = [arg for arg in args if arg]
295295
success = self._invoke(args, True, autoraise, url)

0 commit comments

Comments
 (0)