[geary/geary-0.11] Fix infinite loop when sending long space-stuffed line. Bug 768642.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.11] Fix infinite loop when sending long space-stuffed line. Bug 768642.
- Date: Mon, 8 Aug 2016 00:01:40 +0000 (UTC)
commit 57878e063215b256a3a90e8d81a13ece4886c190
Author: Michael James Gratton <mike vee net>
Date: Mon Aug 8 09:55:44 2016 +1000
Fix infinite loop when sending long space-stuffed line. Bug 768642.
Ported from 6aacb75 on master.
* src/client/util/util-webkit.vala (Util.DOM.html_to_flowed_text): If a
line is space-stuffed, ignore the stuffing space when determining where
to break the line.
src/client/util/util-webkit.vala | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala
index 98b06ac..032baba 100644
--- a/src/client/util/util-webkit.vala
+++ b/src/client/util/util-webkit.vala
@@ -305,7 +305,11 @@ public string decorate_quotes(string text) throws Error {
return outtext;
}
-// This will modify/reset the DOM
+/**
+ * Convert a HTML DOM tree to RFC 3676 format=flowed text.
+ *
+ * This will modify/reset the DOM.
+ */
public string html_to_flowed_text(WebKit.DOM.HTMLElement el) {
string saved_doc = el.get_inner_html();
WebKit.DOM.NodeList blockquotes;
@@ -364,15 +368,19 @@ public string html_to_flowed_text(WebKit.DOM.HTMLElement el) {
int max_len = 72 - prefix.length;
do {
- if (quote_level == 0 && (line.has_prefix(">") || line.has_prefix("From")))
+ int start_ind = 0;
+ if (quote_level == 0 &&
+ (line.has_prefix(">") || line.has_prefix("From"))) {
line = " " + line;
+ start_ind = 1;
+ }
int cut_ind = line.length;
if (cut_ind > max_len) {
string beg = line[0:max_len];
- cut_ind = beg.last_index_of(" ") + 1;
+ cut_ind = beg.last_index_of(" ", start_ind) + 1;
if (cut_ind == 0) {
- cut_ind = line.index_of(" ") + 1;
+ cut_ind = line.index_of(" ", start_ind) + 1;
if (cut_ind == 0)
cut_ind = line.length;
if (cut_ind > 998 - prefix.length)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]