From c53a3eed701ed7b347a40b4ac6bd45660fc19d6e Mon Sep 17 00:00:00 2001 From: John Date: Sat, 8 Jun 2019 00:37:17 +0200 Subject: disallow spaces in urls and e-mail addresses Technically, spaces are permitted in e-mail addresses if quoted, but this is very uncommon. --- dwim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwim b/dwim index 9e000aa..b646de6 100755 --- a/dwim +++ b/dwim @@ -22,12 +22,12 @@ my $MAILROOT = env MAILROOT => "/home/john/mail/"; our $handler; for ($phrase) { - if (/^(https?:\/?\/?.+)$/) { + if (/^(https?:\/?\/?[^\s]+)$/) { handle "web address"; run @BROWSER, "$1" } - if (/^(mailto:.+)$/ or /^(.+@.+\.\w+)$/) { + if (/^(mailto:[^\s]+)$/ or /^([^\s]+@.+\.\w+)$/) { handle "e-mail address"; run @MAILER, "$1" } -- cgit v1.2.3