diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-13 11:22:03 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-13 11:29:34 +0000 |
commit | 00f6c36b603416b73e1327ac4c862b1eaca2d277 (patch) | |
tree | e9004fd7ae4ea91a9d8908fe86ea0e0d97801bef /desktop/source/deployment/misc/dp_misc.cxx | |
parent | b926ba60d11cb78b4e042e2abb2d00dde128a1f8 (diff) |
Fix/simplify some vnd.sun.star.expand: handling
The vnd.sun.star.expand: payload must be URL-decoded prior to passing
it to expandMacros; the protocol must be checked case-insensitively.
Use startsWithIgnoreAsciiCase for that.
Change-Id: I2be993a0400a27cb7dc57207cd0824b4505afd2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146855
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop/source/deployment/misc/dp_misc.cxx')
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index ea5c737c2d7b..ed394382bb5c 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -300,9 +300,7 @@ OUString expandUnoRcTerm( OUString const & term_ ) OUString makeRcTerm( OUString const & url ) { OSL_ASSERT( url.match( "vnd.sun.star.expand:" )); - if (url.match( "vnd.sun.star.expand:" )) { - // cut protocol: - OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); + if (OUString rcterm; url.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", &rcterm)) { // decode uric class chars: rcterm = ::rtl::Uri::decode( rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); @@ -315,9 +313,7 @@ OUString makeRcTerm( OUString const & url ) OUString expandUnoRcUrl( OUString const & url ) { - if (url.match( "vnd.sun.star.expand:" )) { - // cut protocol: - OUString rcurl( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); + if (OUString rcurl; url.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", &rcurl)) { // decode uric class chars: rcurl = ::rtl::Uri::decode( rcurl, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); |