From 7ed53a3fe14ebf25b4513f4be831eb0f731fa0f3 Mon Sep 17 00:00:00 2001 From: Kevin Hendricks Date: Thu, 30 Nov 2023 10:16:18 -0500 Subject: [PATCH] make OPF parsing robust to attribute whitespace alternatives --- src/Parsers/OPFParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Parsers/OPFParser.cpp b/src/Parsers/OPFParser.cpp index 4cc556fef1..34c94795d1 100644 --- a/src/Parsers/OPFParser.cpp +++ b/src/Parsers/OPFParser.cpp @@ -23,6 +23,8 @@ #include "Parsers/OPFParser.h" #include +const QString WHITESPACE_CHARS=" \t\n\r"; // valid in pure xml + // Note: all hrefs/urls should always be kept in URLEncoded form // as decoding urls before splitting into component parts can lead // to data loss (paths can legally contain url delimiters when decoded - such as #) @@ -358,7 +360,7 @@ int BaseParser::findTarget(const QString &tgt, int p, bool after) int BaseParser::skipAnyBlanks(const QStringRef &tgt, int p) { - while((p < tgt.length()) && (tgt.at(p) == ' ')) p++; + while((p < tgt.length()) && (WHITESPACE_CHARS.contains(tgt.at(p)))) p++; return p; }