sw33bf08: #i108078#: ::sfx2::createBaseURI(): decode content of expand URI

This commit is contained in:
Michael Stahl 2010-08-12 16:13:11 +02:00
parent 7b40b729c0
commit f47d90f206

View file

@ -45,6 +45,7 @@
#include <rtl/uuid.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
#include <rtl/bootstrap.hxx>
#include <comphelper/interaction.hxx>
@ -140,11 +141,19 @@ uno::Reference<rdf::XURI> createBaseURI(
// #i108078# workaround non-hierarchical vnd.sun.star.expand URIs
// this really should be done somewhere else, not here.
::rtl::OUString pkgURI(i_rPkgURI);
if (pkgURI.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:")))
if (pkgURI.matchIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:")))
{
// expand it here (makeAbsolute requires hierarchical URI)
pkgURI = pkgURI.copy( sizeof("vnd.sun.star.expand:") - 1 );
::rtl::Bootstrap::expandMacros(pkgURI);
pkgURI = pkgURI.copy( RTL_CONSTASCII_LENGTH("vnd.sun.star.expand:") );
if (pkgURI.getLength() != 0) {
pkgURI = ::rtl::Uri::decode(
pkgURI, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8);
if (pkgURI.getLength() == 0) {
throw uno::RuntimeException();
}
::rtl::Bootstrap::expandMacros(pkgURI);
}
}
const uno::Reference<lang::XMultiComponentFactory> xServiceFactory(