summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-25 11:50:52 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-25 11:50:52 +0100
commitaefea2293cbd956e01a9652ed588388ce6aee713 (patch)
treed3489b477d64ec84decf71f2303fbe411505b10e /ucb
parent6662010db003256b59cc57f20085abb6f1b6b929 (diff)
slidecopy: proper en/decoding of extension IDs
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/ext/ucpext_content.cxx24
-rw-r--r--ucb/source/ucp/ext/ucpext_content.hxx4
-rw-r--r--ucb/source/ucp/ext/ucpext_datasupplier.cxx4
3 files changed, 15 insertions, 17 deletions
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
index 31594dd5eb..c16efbf17c 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -60,6 +60,7 @@
#include <comphelper/string.hxx>
#include <comphelper/componentcontext.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/uri.h>
#include <algorithm>
@@ -172,7 +173,7 @@ namespace ucb { namespace ucp { namespace ext
m_sPathIntoExtension = m_sExtensionId.copy( nNextSep + 1 );
m_sExtensionId = m_sExtensionId.copy( 0, nNextSep );
}
- m_sExtensionId = Content::deescapeIdentifier( m_sExtensionId );
+ m_sExtensionId = Content::decodeIdentifier( m_sExtensionId );
}
}
@@ -302,23 +303,20 @@ namespace ucb { namespace ucp { namespace ext
}
//------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString Content::escapeIdentifier( const ::rtl::OUString& i_rIdentifier )
+ ::rtl::OUString Content::encodeIdentifier( const ::rtl::OUString& i_rIdentifier )
{
- const ::rtl::OUString sQuoteQuotes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
- i_rIdentifier, "%", "%%" );
- const ::rtl::OUString sQuoteSlashes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
- i_rIdentifier, "/", "%47" );
- return sQuoteSlashes;
+ ::rtl::OUString sEncoded;
+ rtl_uriEncode( i_rIdentifier.pData, rtl_getUriCharClass( rtl_UriCharClassUricNoSlash ),
+ rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8, &sEncoded.pData );
+ return sEncoded;
}
//------------------------------------------------------------------------------------------------------------------
- ::rtl::OUString Content::deescapeIdentifier( const ::rtl::OUString& i_rIdentifier )
+ ::rtl::OUString Content::decodeIdentifier( const ::rtl::OUString& i_rIdentifier )
{
- const ::rtl::OUString sQuoteQuotes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
- i_rIdentifier, "%%", "%" );
- const ::rtl::OUString sQuoteSlashes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
- i_rIdentifier, "%47", "/" );
- return sQuoteSlashes;
+ ::rtl::OUString sDecoded;
+ rtl_uriDecode( i_rIdentifier.pData, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &sDecoded.pData );
+ return sDecoded;
}
//------------------------------------------------------------------------------------------------------------------
diff --git a/ucb/source/ucp/ext/ucpext_content.hxx b/ucb/source/ucp/ext/ucpext_content.hxx
index aaa394aa89..3a8a210593 100644
--- a/ucb/source/ucp/ext/ucpext_content.hxx
+++ b/ucb/source/ucp/ext/ucpext_content.hxx
@@ -82,9 +82,9 @@ namespace ucb { namespace ucp { namespace ext
);
static ::rtl::OUString
- escapeIdentifier( const ::rtl::OUString& i_rIdentifier );
+ encodeIdentifier( const ::rtl::OUString& i_rIdentifier );
static ::rtl::OUString
- deescapeIdentifier( const ::rtl::OUString& i_rIdentifier );
+ decodeIdentifier( const ::rtl::OUString& i_rIdentifier );
virtual ::rtl::OUString getParentURL();
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
index 54df114946..ee3eb9993e 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -167,7 +167,7 @@ namespace ucb { namespace ucp { namespace ext
const ::rtl::OUString& rLocalId = (*pExtInfo)[0];
ResultListEntry aEntry;
- aEntry.sId = lcl_compose( sContentIdentifier, Content::escapeIdentifier( rLocalId ) );
+ aEntry.sId = lcl_compose( sContentIdentifier, Content::encodeIdentifier( rLocalId ) );
m_pImpl->m_aResults.push_back( aEntry );
}
}
@@ -327,7 +327,7 @@ namespace ucb { namespace ucp { namespace ext
case E_ROOT:
{
const ::rtl::OUString& rId( m_pImpl->m_aResults[ i_nIndex ].sId );
- const ::rtl::OUString sTitle = Content::deescapeIdentifier( rId.copy( rId.indexOf( '/' ) + 1 ) );
+ const ::rtl::OUString sTitle = Content::decodeIdentifier( rId.copy( rId.indexOf( '/' ) + 1 ) );
xRow = Content::getArtificialNodePropertyValues( m_pImpl->m_xSMgr, getResultSet()->getProperties(), sTitle );
}
break;