mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -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
|
done
|
||||||
} 2>&- # send bash's complaints to the abyss
|
} 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
|
__notice_generate_id() { # wraps around every 25 years
|
||||||
: "${1:?missing seed}"
|
: "${1:?missing seed}"
|
||||||
REPLY=""
|
REPLY=""
|
||||||
|
@ -246,6 +256,8 @@ __notice_upload() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
[ "$interrupt" != 1 ] || return 127
|
[ "$interrupt" != 1 ] || return 127
|
||||||
|
normal="$(__notice_urlencode2 "$normal")"
|
||||||
|
aux="$(__notice_urlencode2 "$aux")"
|
||||||
REPLY="$(__notice_log)"
|
REPLY="$(__notice_log)"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue