[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
Julien Nabet
serval2412 at yahoo.fr
Fri Aug 18 12:11:38 UTC 2017
sc/source/core/tool/interpr7.cxx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit fdaee404f3216441d6b78636c0defae580f26034
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Aug 12 12:34:46 2017 +0200
tdf#109104: respect RFC3986 for newlines in ScEncodeURL
Quotation of RFC3986:
A percent-encoded octet is encoded as a character
triplet, consisting of the percent character "%" followed by the two
hexadecimal digits representing that octet's numeric value
So test the length of the return of OString::number and add "0" if needed
ScEncodeURL was added with:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=25434372bf56e0ebdb7e7d47ab3c14c68211509f
Thank you to Bele (the bugtracker reporter) for code pointer!
Change-Id: I8df102eb38b31933c6ebb15bb25c125b423f722b
Reviewed-on: https://gerrit.libreoffice.org/41086
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit dabba2e3368c2e2ae4ab03ddcfc667e13f89841d)
Reviewed-on: https://gerrit.libreoffice.org/41279
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index b226717c2935..48a34b3ece36 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -325,7 +325,14 @@ void ScInterpreter::ScEncodeURL()
else
{
aUrlBuf.append( '%' );
- aUrlBuf.append( OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase() );
+ OString convertedChar = OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase();
+ // RFC 3986 indicates:
+ // "A percent-encoded octet is encoded as a character triplet,
+ // consisting of the percent character "%" followed by the two hexadecimal digits
+ // representing that octet's numeric value"
+ if (convertedChar.getLength() == 1)
+ aUrlBuf.append("0");
+ aUrlBuf.append(convertedChar);
}
}
PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) );
More information about the Libreoffice-commits
mailing list