Fix line feeds in saved file
alex wennerberg alex@alexwennerberg.com
Sat, 05 Dec 2020 17:57:15 -0800
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
http.go
→
http.go
@@ -134,7 +134,11 @@ }
} else if r.Method == "POST" { // get post body r.ParseForm() - fileBytes := []byte(r.Form.Get("file_text")) + fileText := r.Form.Get("file_text") + // Web form by default gives us CR LF newlines. + // Unix files use just LF + fileText = strings.ReplaceAll(fileText, "\r\n", "\n") + fileBytes := []byte(fileText) err := checkIfValidFile(filePath, fileBytes) if err != nil { log.Println(err)