Fix crash when getting preview with long html tags

Closes: bgo #726468
This commit is contained in:
Simon Lipp 2014-03-17 12:39:08 -07:00 committed by Charles Lindsay
parent 1a41622696
commit 6e6df92c05
2 changed files with 3 additions and 3 deletions

1
THANKS
View file

@ -20,6 +20,7 @@ Mathias Hasselmann <mathias@openismus.com>
Timo Kluck <tkluck@infty.nl>
Charles Lehner <rdm.cel@celehner.com>
Avi Levy <avi.w.levy@gmail.com>
Simon Lipp <bugs-gnome@simon.lipp.name>
Brendan Long <self@brendanlong.com>
Angelo Marchesin <marchesin.angelo@gmail.com>
Kai Mast <mail@kai-mast.de>

View file

@ -124,9 +124,8 @@ public string remove_html_tags(string input) {
Regex style = new Regex("<style[^>]*?>[\\s\\S]*?<\\/style>", RegexCompileFlags.CASELESS);
output = style.replace(output, -1, 0, "");
// Removes remaining tags. Based on this regex:
// http://osherove.com/blog/2003/5/13/strip-html-tags-from-a-string-using-regular-expressions.html
Regex tags = new Regex("<(.|\n)*?>", RegexCompileFlags.CASELESS);
// Removes remaining tags.
Regex tags = new Regex("<[^>]*>", RegexCompileFlags.CASELESS);
return tags.replace(output, -1, 0, "");
} catch (Error e) {
debug("Error stripping HTML tags: %s", e.message);