From e151b8e604a504a6d88c4d347986aac1d80f6ce4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Mar 2022 17:30:47 +0530 Subject: [PATCH] Make detection of pasted URLs a little stricter --- kitty/window.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kitty/window.py b/kitty/window.py index 18ea3f071..e352d0b79 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -1263,9 +1263,12 @@ class Window: return if 'quote-urls-at-prompt' in opts.paste_actions and self.at_prompt: prefixes = '|'.join(opts.url_prefixes) - if re.match(f'{prefixes}:', text) is not None: - import shlex - text = shlex.quote(text) + m = re.match(f'({prefixes}):(.+)', text) + if m is not None: + scheme, rest = m.group(1), m.group(2) + if rest.startswith('//') or scheme in ('mailto', 'irc'): + import shlex + text = shlex.quote(text) btext = text.encode('utf-8') if 'confirm' in opts.paste_actions: msg = ''