Fix a panic in flow and cd into the test-client in run.sh

This commit is contained in:
Melon 2023-10-09 16:42:50 +01:00
parent b15aa72ec0
commit 983b5a42e1
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
3 changed files with 5 additions and 2 deletions

View File

@ -76,7 +76,7 @@ func (h *HttpServer) flowCallback(rw http.ResponseWriter, req *http.Request, _ h
q := req.URL.Query()
state := q.Get("state")
n := strings.IndexByte(state, ':')
if !h.manager.CheckNamespace(state[:n]) {
if n == -1 || !h.manager.CheckNamespace(state[:n]) {
http.Error(rw, "Invalid state namespace", http.StatusBadRequest)
return
}

View File

@ -3,6 +3,7 @@ package pages
import (
"embed"
_ "embed"
"errors"
"github.com/1f349/overlapfs"
"html/template"
"io"
@ -26,7 +27,7 @@ func LoadPages(wd string) (err error) {
if wd != "" {
wwwDir := filepath.Join(wd, "www")
err = os.Mkdir(wwwDir, os.ModePerm)
if err != nil {
if err != nil && !errors.Is(err, os.ErrExist) {
return
}
wdFs := os.DirFS(wwwDir)

View File

@ -1,2 +1,4 @@
#!/bin/bash
cd "$(dirname -- "$(readlink -f -- "$0";)";)"
python3 -m http.server 2020