It ignores '\n' so pastes look like one long line if GUI is not used
Closed this issue · 1 comments
t0nik0 commented
or just cut the text if '\r' has been used:
$ echo -e 'Hello\nworld' | curl -w'\n' -q -L -d @- -o - http://localhost:8000/pb
http://localhost:8000/pb/raw/esBMfvlMqPdS9q93w0UWa
$ curl http://localhost:8000/pb/raw/esBMfvlMqPdS9q93w0UWa
Helloworld$
$ echo -e 'Hello\n\rworld' | curl -w'\n' -q -L -d @- -o - http://localhost:8000/pb
http://localhost:8000/pb/raw/3BbQLjwfYQAujQemn57Jg
$ curl http://localhost:8000/pb/raw/3BbQLjwfYQAujQemn57Jg
Hello$
$ echo -e 'Hello\n\nworld' | curl -w'\n' -q -L -d @- -o - http://localhost:8000/pb
http://localhost:8000/pb/raw/CrnsJ2ShoZCkUS5bnW491
$ curl http://localhost:8000/pb/raw/CrnsJ2ShoZCkUS5bnW491
Helloworld$
$ echo -e 'Hello\n\n\nworld' | curl -w'\n' -q -L -d @- -o - http://localhost:8000/pb
http://localhost:8000/pb/raw/N13YK6Jq-BkNxWrEJ0I5i
$ curl http://localhost:8000/pb/raw/N13YK6Jq-BkNxWrEJ0I5i
Helloworld$
mkaczanowski commented
The problem you described is not a fault of the pastebin itself but the way cURL works.
This creates the multiline output which curl handles as "Helloworld" and passes it in that form to pastebin service:
$ echo -e 'Hello\nworld'
Hello
world
If for instance, you decide to use httpie (https://httpie.io/):
$ echo -e 'Hello\nworld' | http -p b http://localhost:8000
http://localhost:8000/XOzLQ9ehSiMz-OZmCSPyp
$ curl "http://localhost:8000/raw/WLoItLb9Zqllwr9nj3uFR"
Hello
world
then the multiline gets converted to "Hello\nworld\n" and shipped to pastebin service