Skip to content

Commit d2bbcc6

Browse files
committed
Fix dasht-server-http serving "400 Bad Request" on requests for "/"
This was reported in #51. It's not clear to me if this only affects macOS users. The problem was the `grep` query changed in this commit doesn't match queries for "/": ~ $ cat urls / /? /?query /foo /bar ~ $ cat urls | grep '^/$\|^/?' /? /?query The two patterns to match for are fairly simple, so they can instead be tested for with simple string equality checks.
1 parent 5a741da commit d2bbcc6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/dasht-server-http

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ url=$(awk '
7575

7676
# serve translated local file:// URLs over HTTP
7777
# (skip the / homepage and /? form submissions)
78-
if ! echo "$url" | grep -q '^/$\|^/?'; then
78+
if ! test "$url" = / -o -z "${url##/\?*}"; then
7979
file=${url%#*} # strip URI fragment, if any
8080

8181
if test -f "$file"; then

0 commit comments

Comments
 (0)