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
commit902c2a5a1dffe4db1637ec4eb2c6cbd7efb14ffd (patch)
tree48e6aed93228fe0c9a71a16ea5a8e9dc94c2b53a /ucb
parent22b13738ef17f9850d79a573343cc44d7396235b (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 df04798b2c56..d8076db33ae2 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 8e3e8fa386c7..a9ee22ca8078 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 3c99c95197ee..dcc1c117befa 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;