shaarli / python-shaarli-client

Python3 CLI to interact with a Shaarli instance
https://python-shaarli-client.readthedocs.io/
MIT License
44 stars 10 forks source link

Post link with newline in the description #43

Closed toolleeo closed 2 years ago

toolleeo commented 5 years ago

How can post a link from the command line that has a description that should contain a newline when displayed in the shaarli online instance?

When trying something like (see the newlines in the description)

shaarli post-link --url 'http://test.url/' --title 'Test' --description 'One\nword\nper\nline.'

The shaarli script (v 0.3.0) returns

{
    "created": "2019-08-04T09:56:11+02:00",
    "description": "One\\nword\\nper\\nline.",
    "id": 2786,
    "private": false,
    "shorturl": "r-KS6g",
    "tags": [],
    "title": "Test",
    "updated": "",
    "url": "http://test.url/"
}

The newlines are escaped, and the text in the online shaarli instance contains the '\n' text verbatim instead of the actual newline.

Using '\r\n' instead of '\n' does not work either.

May this be a shaarli API issue?

nodiscc commented 5 years ago

Related https://github.com/shaarli/Shaarli/issues/1360

After a few tests, you can use actual line breaks, or this syntax: --description $'One\nword\nper\nline.'

nodiscc commented 2 years ago

https://github.com/shaarli/python-shaarli-client/pull/66