summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--got/view_blob.got1
-rw-r--r--src/edit/posthack.go3
2 files changed, 4 insertions, 0 deletions
diff --git a/got/view_blob.got b/got/view_blob.got
index 16d7ff1..0d7c80c 100644
--- a/got/view_blob.got
+++ b/got/view_blob.got
@@ -8,6 +8,7 @@
{{if istext .ctype}}
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PUT">
+ <input type="hidden" name="_body_decrlf" value="1">
<textarea name="_body">{{.content | html }}</textarea>
<label>
Description of change:
diff --git a/src/edit/posthack.go b/src/edit/posthack.go
index 9e4759e..fad692b 100644
--- a/src/edit/posthack.go
+++ b/src/edit/posthack.go
@@ -44,6 +44,9 @@ func PostHack(req *http.Request) {
req.MultipartForm = nil
} else if bodies := req.PostForm["_body"]; len(bodies) > 0 {
body := bodies[0]
+ if req.PostFormValue("_body_decrlf") != "" {
+ body = strings.Replace(body, "\r\n", "\n", -1)
+ }
req.Body = ioutil.NopCloser(strings.NewReader(body))
if req.Header.Get("Content-Length") != "" {
req.Header.Set("Content-Length", strconv.Itoa(len(body)))