summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
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'