From 6e6df92c0501ec8801487fdaab2ba0334a7d7a80 Mon Sep 17 00:00:00 2001 From: Simon Lipp Date: Mon, 17 Mar 2014 12:39:08 -0700 Subject: [PATCH] Fix crash when getting preview with long html tags Closes: bgo #726468 --- THANKS | 1 + src/engine/util/util-html.vala | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/THANKS b/THANKS index 5c2228c1..8d266e17 100644 --- a/THANKS +++ b/THANKS @@ -20,6 +20,7 @@ Mathias Hasselmann Timo Kluck Charles Lehner Avi Levy +Simon Lipp Brendan Long Angelo Marchesin Kai Mast diff --git a/src/engine/util/util-html.vala b/src/engine/util/util-html.vala index dc0b3901..cab2c684 100644 --- a/src/engine/util/util-html.vala +++ b/src/engine/util/util-html.vala @@ -124,9 +124,8 @@ public string remove_html_tags(string input) { Regex style = new Regex("]*?>[\\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);