mirror of
https://github.com/notwa/rc
synced 2024-11-05 06:39:02 -08:00
properly urlencode links in notice
This commit is contained in:
parent
b416171017
commit
752606119e
1 changed files with 12 additions and 0 deletions
12
sh/notice
12
sh/notice
|
@ -49,6 +49,16 @@ __notice_urlencode() {
|
|||
done
|
||||
} 2>&- # send bash's complaints to the abyss
|
||||
|
||||
__notice_urlencode2() {
|
||||
while test "$1"; do
|
||||
case "$1" in
|
||||
([:/a-zA-Z0-9~_.-]*) printf '%.1s' "$1";; # : and / added here
|
||||
(*) printf '%%%02X' "'$1";; # bash complains but works
|
||||
esac
|
||||
set -- "${1#?}"
|
||||
done
|
||||
} 2>&- # send bash's complaints to the abyss
|
||||
|
||||
__notice_generate_id() { # wraps around every 25 years
|
||||
: "${1:?missing seed}"
|
||||
REPLY=""
|
||||
|
@ -246,6 +256,8 @@ __notice_upload() {
|
|||
return 1
|
||||
}
|
||||
[ "$interrupt" != 1 ] || return 127
|
||||
normal="$(__notice_urlencode2 "$normal")"
|
||||
aux="$(__notice_urlencode2 "$aux")"
|
||||
REPLY="$(__notice_log)"
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue