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

Closed
opened 2 years ago by setiseta · 2 comments
setiseta commented 2 years ago

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!
witten closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.