Sweets / tiramisu

Desktop notifications, the UNIX way
MIT License
740 stars 19 forks source link

Icons cause corrupt JSON (improper JSON escape sequences)? #12

Closed Barbaross93 closed 4 years ago

Barbaross93 commented 4 years ago

Hello,

I've recently updated and suddenly some of my notifications no longer work. I use this in conjunction with jq to parse notifications into polybar. I figured out that for notifications that have an icon in their body, jq complains and states pares error: Invalid escape at line 1, column 169. The particular JSON tiramisu spat out to trigger this error is { "app_name": "notify-send", "app_icon": "", "replaces_id": "0", "timeout": "3000", "hints": { "urgency": 1}, "actions": {}, "summary": "\357\211\223 01:24:46 remaining", "body": "" } I thought perhaps it was an issue with jq, but it seems to be that people with similar issues with escape sequences in their JSON turn out to have bad JSON output to start with (Here's one example: https://stackoverflow.com/questions/49073376/jq-escaping-backslash-in-keyname) I apologize if the link referenced has nothing to do with what I'm experiencing as I don't fully understand the error myself.

cglindkamp commented 4 years ago

This may be caused by my recent change of using g_strescape instead of the sanitize function, which escapes not only newlines but also some other characters including all non-ascii characters. The escaping of non-ascii characters is the problem here. Unfortunately, glib does not seem to have an unicode aware escaping function. Maybe a custom function is still needed.

cglindkamp commented 4 years ago

Can you please test, if the issue is still happening with PR #13?

Barbaross93 commented 4 years ago

It seems to be working! I haven't noticed any problems so far. Thank you!

EDIT Unfortunately it looks like duplicate body & summary as well as duplicate app_name & app_icon is back again though

cglindkamp commented 4 years ago

Are you sure you tested with PR #13? I have not reverted the buggy commit, but switched the sanitization function. So both problems should be fixed (on my end, they are).

Barbaross93 commented 4 years ago

Ah woops, somehow I wasn't using the appropriate branch. I'm definitely using it now. Looks like its working!

Sweets commented 4 years ago

Haven't had internet for a while, glad someone caught this @cglindkamp Closing this and related issue #10