-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving notification content with invalid pango markup breaks format markup #55
Comments
Hmm, yes, I've experienced this too. The spec allows us to advertise that we support markup, but doesn't allow clients to opt-out. :( I think the fix you suggest is reasonable. |
Mako should probably filter unsupported html tags as well and only keep those that are defined in the freedesktop specification. I remember that was an problem in dunst. Well, in the current version it simply tries pango markup and strips all tags if an error occurs. It seems that was greatly simplified some time ago. |
I don't know if there's a good way to do this without accidentally ruining some notifications' content. For example, if someone sends me a message on slack that contains a tag, I don't want that tag to be removed, since it was intended as the literal text of the tag. |
I guess in that case keep the tags for now and when a bug report is filed, add a criteria option to strip tags when receiving notifications from known bad clients. |
Hmmm, perhaps the |
If the body of a notification contains something that pango considers to be invalid markup, the markup within the user-specified format will be ignored as well (see screenshot for an example). This is because we're parsing the entire formatted notification at once. This is required to have relative markup work correctly, but it could be made more robust. Here's what I propose:
pango_parse_markup
, without saving the result.escape_markup
function before formatting.This will allow the user's format to continue working (e.g. to display the summary in bold) even when the body is unparseable. It's arguable that this isn't a mako bug, but the result of clients sending notifications that don't follow the spec. However, I've now seen this from two separate programs (including Slack), so it's probably worth putting a bandaid on.
An example of the
<
character causing parsing to fail.The text was updated successfully, but these errors were encountered: