summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-27 06:32:33 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-27 06:32:33 (GMT)
commitf046f24edb49e2c668fa6ce3bd5c27b639bad479 (patch)
treeabc2560cfc98176ba67fadf345f7a194fb0ec57e
parent9655108a4524c394d73765dba12267f0afe88570 (diff)
Fix parsing error when we have < or > in comment
-rw-r--r--src/ksieveui/scriptsparsing/tests/failed/README-FAILED-INFO1
-rw-r--r--src/parser/lexer.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/ksieveui/scriptsparsing/tests/failed/README-FAILED-INFO b/src/ksieveui/scriptsparsing/tests/failed/README-FAILED-INFO
new file mode 100644
index 0000000..301ed33
--- /dev/null
+++ b/src/ksieveui/scriptsparsing/tests/failed/README-FAILED-INFO
@@ -0,0 +1 @@
+script1.siv failed as parser doesn't like "<" or ">" in comment => I workaround by changed it as double quote
diff --git a/src/parser/lexer.cpp b/src/parser/lexer.cpp
index 6b4ca95..7e06a3b 100644
--- a/src/parser/lexer.cpp
+++ b/src/parser/lexer.cpp
@@ -385,6 +385,10 @@ bool Lexer::Impl::parseHashComment(QString &result, bool reallySave)
}
if (reallySave) {
result += QString::fromUtf8(commentStart, commentLength);
+ // In comment < or > breaks parsing => convert them to double quote
+ // See src/ksieveui/scriptsparsing/tests/failed/script1.siv
+ result.replace(QLatin1Char('<'), QLatin1Char('"'));
+ result.replace(QLatin1Char('>'), QLatin1Char('"'));
}
}
return true;