1ea5ac3d290001b1fb9ea38c3c1383b186a00929 — Tommy Nguyen 1 year, 7 months ago eb2bac8
Normalize linefeeds to \n when POST'ing data

When you submit an HTML form, the W3 standard requires the data be
separated by CRLF. However, some people will find this surprising so we
normalize the linefeeds, which is what services like Gist do.

Fixes #10
1 files changed, 1 insertions(+), 0 deletions(-)

M pastesrht/blueprints/api/pastes.py
M pastesrht/blueprints/api/pastes.py => pastesrht/blueprints/api/pastes.py +1 -0
@@ 32,6 32,7 @@ def pastes_POST():
        valid.expect(isinstance(f, dict),
                f"Expected files[{i}] to be dict", field=f"files[{i}]")
        contents = f.get("contents")
        contents = contents.replace('\r\n', '\n').replace('\r', '\n')
        filename = f.get("filename")
        valid.expect(contents, f"files[{i}].contents is required",