diff options
author | John <john@ankarstrom.se> | 2019-06-08 00:37:17 +0200 |
---|---|---|
committer | John <john@ankarstrom.se> | 2019-06-08 00:44:37 +0200 |
commit | c53a3eed701ed7b347a40b4ac6bd45660fc19d6e (patch) | |
tree | 674105da83c8fbe7d449f1ebe15c2451ae3e7b2d | |
parent | 9d6275a487140ec7b950d529fd4d60d6a8ee2cdf (diff) | |
download | dwim-c53a3eed701ed7b347a40b4ac6bd45660fc19d6e.tar.gz |
disallow spaces in urls and e-mail addresses
Technically, spaces are permitted in e-mail addresses if quoted, but
this is very uncommon.
-rwxr-xr-x | dwim | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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" } |