svgio/source/svgreader/svgtools.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
New commits: commit 66ba1c64f3b7a3d0a05523bb1b25b65e48a303ea Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jul 7 11:02:28 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jul 7 16:59:36 2022 +0200 svgio: make readLocalUrl standard-compliant See https://bugs.documentfoundation.org/show_bug.cgi?id=149880#c12 Thanks to Mike Kaganski for the references Change-Id: Idb06cf40ee992dd73120ce051d8ba4f61faaadfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136877 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins (cherry picked from commit e03cd0893eb2031d775764b4696b838dd09fb474) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136864 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 7fd541a2a93e..94f8f20d5f0e 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -1059,21 +1059,29 @@ namespace svgio::svgreader bool readLocalUrl(const OUString& rCandidate, OUString& rURL) { - static const char aStrUrl[] = "url"; + static const char aStrUrl[] = "url("; - if(rCandidate.startsWith(aStrUrl)) + if(rCandidate.startsWithIgnoreAsciiCase(aStrUrl)) { const sal_Int32 nLen(rCandidate.getLength()); sal_Int32 nPos(strlen(aStrUrl)); - - skip_char(rCandidate, '(', nPos, nLen); sal_Unicode aLimiter(')'); + skip_char(rCandidate, ' ', nPos, nLen); + if('"' == rCandidate[nPos]) + { aLimiter = '"'; + ++nPos; + } + else if('\'' == rCandidate[nPos]) + { + aLimiter = '\''; + ++nPos; + } - skip_char(rCandidate, '"', nPos, nLen); - skip_char(rCandidate, '#', nPos, nLen); + skip_char(rCandidate, ' ', nPos, nLen); + skip_char(rCandidate, '#', nPos, nPos + 1); OUStringBuffer aTokenValue; copyToLimiter(rCandidate, aLimiter, nPos, aTokenValue, nLen);