Be less permissive in urlize() and use `^' again in REs. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
(HTM) hg clone https://bitbucket.org/iamleot/plumb
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset d778f10d9d3bcd1f2b060dfbcd57008282e35a0b
(DIR) parent 53dd7bd9afc9af59b9ca537b86adc4b251d6b390
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Fri, 30 Mar 2018 10:28:41
Be less permissive in urlize() and use `^' again in REs.
For URLs already containing some patters (e.g. CVE-* ones) not
having a `^' in RE can be problematic and lead to accidently
substitute them.
Diffstat:
dplumb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff -r 53dd7bd9afc9 -r d778f10d9d3b dplumb
--- a/dplumb Thu Mar 29 11:13:19 2018 +0200
+++ b/dplumb Fri Mar 30 10:28:41 2018 +0200
@@ -58,10 +58,10 @@
{
sed \
- -E -e 's;(CVE-[0-9]+-[0-9]+).*$;cve://\1;g' \
- -E -e 's;doi:(//)?;doi://;g' \
+ -E -e 's;^(CVE-[0-9]+-[0-9]+).*$;cve://\1;g' \
+ -E -e 's;^doi:(//)?;doi://;g' \
-E -e 's;mailto:(//)?;mailto://;g' \
- -E -e 's;ar[Xx]iv:(//)?;arxiv://;g'
+ -E -e 's;^ar[Xx]iv:(//)?;arxiv://;g'
}
#