all repos — flounder @ 4bd0c00ffa82f67b619dd88c894107c0cfbd5d20

A small site builder for the Gemini protocol

add error handling on new file
alex wennerberg alex@alexwennerberg.com
Wed, 18 Nov 2020 19:43:52 -0800
commit

4bd0c00ffa82f67b619dd88c894107c0cfbd5d20

parent

80ed56659ae6ebf55bd90aea552acacf0d2efc3e

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M http.gohttp.go

@@ -142,6 +142,12 @@ renderError(w, InternalServerErrorMsg, 500)

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)