summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-04-13 15:39:25 +0200
committertv <tv@krebsco.de>2017-04-13 16:27:04 +0200
commit9f0eb538f970d6fb5755ec03d8368a491bf0e418 (patch)
tree4a121f08690cab9d2e87254b1f1e728036394c15 /examples
parent8efdb0b3ef562f583d7eab2ad781854caacfbf9c (diff)
reduce Bashismv1.2.21.2.2ni/master
Diffstat (limited to 'examples')
-rw-r--r--examples/paste7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/paste b/examples/paste
index 79d48aa..17f34e9 100644
--- a/examples/paste
+++ b/examples/paste
@@ -12,7 +12,7 @@ find_item() {
case "$Method $Request_URI" in
"GET /"[0-9a-z]*)
- if item=$(find_item ${Request_URI:1}); then
+ if item=$(find_item ${Request_URI#/}); then
printf 'HTTP/1.1 200 OK\r\n'
printf 'Content-Type: %s\r\n' "$(file -ib $item)"
printf 'Server: %s\r\n' "$Server"
@@ -43,8 +43,9 @@ case "$Method $Request_URI" in
cp -v $content $item >&2
fi
- if item=$(find_item ${base32:0:7}); then
- ref=$(echo "$ref"; echo "http://$req_host/${base32:0:7}")
+ base32short=$(echo $base32 | cut -b-7)
+ if item=$(find_item $base32short); then
+ ref=$(echo "$ref"; echo "http://$req_host/$base32short")
fi
printf 'HTTP/1.1 200 OK\r\n'