borgmatic list with --json should not use color escape characters #285

Closed
opened 2020-01-21 10:09:26 +00:00 by setiseta · 2 comments

What I'm trying to do and why

using borgmatic list --json to send data to an api got a return:
{"message":"Unexpected token \u001b in JSON at position 10676"}

Steps to reproduce (if a bug)

using command from above to send data with curl to an api
curl -X POST $URL -H 'Content-Type: application/json' -d "$(borgmatic list --json)"

Actual behavior (if a bug)

return message:
{"message":"Unexpected token \u001b in JSON at position 10676"}

Expected behavior (if a bug)

should give an ok.

Other notes / implementation ideas

it seems since there is no color on the json, but it still append some escape characters to end coloring.
as a workaround i can use borgmatic -nc list --json
but i think it is wrong to append escape characters in case of --json where no coloring is used.

Environment

borgmatic version: 1.4.21

borgmatic installation method: pip install

Borg version: borg 1.1.10

Python version: Python 3.6.9

operating system and version: Ubuntu 18.04.3 LTS

#### What I'm trying to do and why using borgmatic list --json to send data to an api got a return: {"message":"Unexpected token \u001b in JSON at position 10676"} #### Steps to reproduce (if a bug) using command from above to send data with curl to an api `curl -X POST $URL -H 'Content-Type: application/json' -d "$(borgmatic list --json)"` #### Actual behavior (if a bug) return message: {"message":"Unexpected token \u001b in JSON at position 10676"} #### Expected behavior (if a bug) should give an ok. #### Other notes / implementation ideas it seems since there is no color on the json, but it still append some escape characters to end coloring. as a workaround i can use `borgmatic -nc list --json` but i think it is wrong to append escape characters in case of `--json` where no coloring is used. #### Environment **borgmatic version:** 1.4.21 **borgmatic installation method:** pip install **Borg version:** borg 1.1.10 **Python version:** Python 3.6.9 **operating system and version:** Ubuntu 18.04.3 LTS
Owner

Thank you for reporting this! The good news is that this is already fixed in master, so I'll cut a release soon and post here when it's out.

Thank you for reporting this! The good news is that this is already fixed in master, so I'll cut a release soon and post here when it's out.
Owner

Okay, this is now released in borgmatic 1.4.22!

Okay, this is now released in borgmatic 1.4.22!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#285
No description provided.