flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 4bd0c00ffa82f67b619dd88c894107c0cfbd5d20
parent 80ed56659ae6ebf55bd90aea552acacf0d2efc3e
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 18 Nov 2020 19:43:52 -0800

add error handling on new file

Diffstat:
Mhttp.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/http.go b/http.go @@ -142,6 +142,12 @@ func editFileHandler(w http.ResponseWriter, r *http.Request) { return } newName := filepath.Clean(r.Form.Get("rename")) + err := checkIfValidFile(newName, fileBytes) + if err != nil { + log.Println(err) + renderError(w, err.Error(), 400) + return + } if newName != fileName { newPath := path.Join(c.FilesDirectory, authUser, newName) os.MkdirAll(path.Dir(newPath), os.ModePerm)