diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-07 11:02:28 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-07 15:40:10 +0200 |
commit | e03cd0893eb2031d775764b4696b838dd09fb474 (patch) | |
tree | d1793dcac8621f67642c77c74a8673dfe8282dbf /svgio | |
parent | adf419792743a4c79b2054e42618dff75bb552ce (diff) |
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.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
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); |