Skip to content

Commit

Permalink
make OPF parsing robust to attribute whitespace alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Nov 30, 2023
1 parent 976dde0 commit 7ed53a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Parsers/OPFParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "Parsers/OPFParser.h"
#include <QDebug>

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 #)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7ed53a3

Please sign in to comment.