Instruct image opener and rules to also open URL that ends with `?...'. - 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 d86a99e60c70cae3df952dbacb69305d60ad77e5
(DIR) parent e2a2076610f2fe297a02c371936d4d0cf4b9788f
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Mon, 6 Aug 2018 23:44:35
Instruct image opener and rules to also open URL that ends with `?...'.
This happens for instagram.com and probably a lot of other <img> URLs...
`image' was modified in order to get rid of all `?...' part.
Diffstat:
openers/image | 3 ++-
rules | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff -r e2a2076610f2 -r d86a99e60c70 openers/image
--- a/openers/image Sat Aug 04 12:30:18 2018 +0200
+++ b/openers/image Mon Aug 06 23:44:35 2018 +0200
@@ -7,6 +7,7 @@
for u in "$@"; do
f=$(basename "$u")
- curl -s --user-agent "${PLUMB_UA}" -Lz "$f" -O "$u"
+ f="${f%%\?*}"
+ curl -s --user-agent "${PLUMB_UA}" -Lz "$f" -o "$f" "$u"
xdg-open "$f" >/dev/null 2>&1 &
done
diff -r e2a2076610f2 -r d86a99e60c70 rules
--- a/rules Sat Aug 04 12:30:18 2018 +0200
+++ b/rules Mon Aug 06 23:44:35 2018 +0200
@@ -5,7 +5,8 @@
*://*.txt | *://*.patch | *://*.diff | *://*.log )
open "txt" "$u"
;;
-*://*.jpg | *://*.jpeg | *://*.png | *://*.gif )
+*://*.jpg | *://*.jpeg | *://*.png | *://*.gif | \
+*://*.jpg\?* | *://*.jpeg\?* | *://*.png\?* | *://*.gif\?* )
open "image" "$u"
;;
*://*.mp3 | *://*.ogg | *://*.m3u8 | *://*.opus | *://*.flac | \