[dev.icinga.com #10366] Text plugin output treated as HTML in too many occasions #2085
Labels
area/monitoring
Affects the monitoring module
bug
Something isn't working
queue/important
Blocks a release or needs immediate attention
Milestone
This issue has been migrated from Redmine: https://dev.icinga.com/issues/10366
Created by tgelf on 2015-10-15 09:07:56 +00:00
Assignee: aklimov
Status: Resolved (closed on 2016-02-17 10:50:03 +00:00)
Target Version: 2.2.0
Last Update: 2016-02-17 10:50:03 +00:00 (in Redmine)
We used to have an insane regex to determine whether output contains HTML. In 39df25f (referring #9036) this got broken by relaxing the check to strip_tags. As a result, most plugin output using something looking like HTML gets wrong treatment and looks ugly. Most prominent example are all kind of usage-hints in case of a misconfigured check command:
This will be interpreted as HTML right now and shown in an ugly way. I'd at least restore former behaviour, but instead of putting the former regex in place try to find an even better one. Thinking about something like this:
That way output is HTML if there is at least something looking like an HTML attribute inside a tag (e.g. , would match also <"> and <'>) or if there is a tag carrying a slash (e.g.
, would match also </>). We could of course be more precise with our regex, but to me this feels as a good compromise between readability, speed and functionality. The following examples should NOT be detected as HTML:The original intent of the former regex got already broken in 9d2f0be, so when fixing this one should also try to figure out what that commit was trying to achieve. As we broke this many times before I'd like to see some unit tests in place for the various cases mentioned above.
Cheers,
Thomas
Changesets
2016-02-17 10:49:23 +00:00 by aklimov bd02e54
Relations:
The text was updated successfully, but these errors were encountered: