diff options
author | tv <tv@krebsco.de> | 2017-04-13 15:39:25 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2017-04-13 16:27:04 +0200 |
commit | 9f0eb538f970d6fb5755ec03d8368a491bf0e418 (patch) | |
tree | 4a121f08690cab9d2e87254b1f1e728036394c15 /examples | |
parent | 8efdb0b3ef562f583d7eab2ad781854caacfbf9c (diff) |
Diffstat (limited to 'examples')
-rw-r--r-- | examples/paste | 7 |
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' |