diff options
author | Cao Cuong Ngo <cao.cuong.ngo@gmail.com> | 2013-09-21 23:36:06 +0200 |
---|---|---|
committer | Cao Cuong Ngo <cao.cuong.ngo@gmail.com> | 2013-09-26 16:15:39 +0200 |
commit | 34f4d2574987b272681b5843e8f5edc374f55fde (patch) | |
tree | 286bc62f7382aec34deb98af0565dea9b6ad4a19 | |
parent | 92db3f7c397ba5508daa386e19caf2b1661ec4b4 (diff) |
CMIS file picker: it really does not like ID Mark
The file picker can't go back folder if we use
ID mark in the URL.
Conflicts:
ucb/source/ucp/cmis/cmis_content.cxx
Change-Id: I6985feec71dc23848ee022e0bab9e8515a21ffd2
-rw-r--r-- | comphelper/source/misc/mediadescriptor.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 14 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_url.cxx | 3 |
4 files changed, 31 insertions, 12 deletions
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 7fd7d5fc272b..21361f565dae 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -47,6 +47,23 @@ namespace comphelper{ +namespace { + + OUString removeFragment(OUString const & uri) { + css::uno::Reference< css::uri::XUriReference > ref( + css::uri::UriReferenceFactory::create( + comphelper::getProcessComponentContext())-> + parse(uri)); + if (ref.is()) { + ref->clearFragment(); + return ref->getUriReference(); + } else { + SAL_WARN("comphelper", "cannot parse <" << uri << ">"); + return uri; + } + } +} + const OUString& MediaDescriptor::PROP_ABORTED() { static const OUString sProp("Aborted"); @@ -467,9 +484,7 @@ sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) css::uno::Reference< css::uno::XInterface >()); // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble - // We need to keep the full URL with Mark to store the Object ID - // in CMIS UCB - return impl_openStreamWithURL( sURL, bLockFile ); + return impl_openStreamWithURL( removeFragment(sURL), bLockFile ); } catch(const css::uno::Exception& ex) { diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 710ea5f73a5b..329cfb8aee5c 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2479,7 +2479,7 @@ void SfxMedium::Init_Impl() { if ( aUrl.HasMark() ) { - // keep the Mark to store the Document ID + pImp->m_aLogicName = aUrl.GetURLNoMark( INetURLObject::NO_DECODE ); GetItemSet()->Put( SfxStringItem( SID_JUMPMARK, aUrl.GetMark() ) ); } @@ -2994,7 +2994,8 @@ const INetURLObject& SfxMedium::GetURLObject() const if (!pImp->m_pURLObj) { pImp->m_pURLObj = new INetURLObject( pImp->m_aLogicName ); - // keep the Mark to store the Document ID + if (pImp->m_pURLObj->HasMark()) + *pImp->m_pURLObj = INetURLObject( pImp->m_aLogicName ).GetURLNoMark(); } return *pImp->m_pURLObj; diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 4bc7c3c6fc7c..48556ed64d3e 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1258,8 +1258,6 @@ namespace cmis m_pObjectType.reset( ); m_pObjectProps.clear( ); m_bTransient = false; - uno::Reference< ucb::XContentIdentifier > xId(new ::ucbhelper::ContentIdentifier(m_sURL)); - m_xIdentifier = xId; inserted(); } } @@ -1538,10 +1536,16 @@ namespace cmis return parentUrl; else { - INetURLObject aParentUrl( m_sURL ); - aParentUrl.removeSegment( ); - return aParentUrl.GetMainURL( INetURLObject::NO_DECODE ); + INetURLObject aUrl( m_sURL ); + if ( aUrl.getSegmentCount( ) > 0 ) + { + URL aCmisUrl( m_sURL ); + aUrl.removeSegment( ); + aCmisUrl.setObjectPath( aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) ); + parentUrl = aCmisUrl.asString( ); + } } + return parentUrl; } XTYPEPROVIDER_COMMON_IMPL( Content ); diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx index 5c0a926a3111..b6dbf6c6b2ef 100644 --- a/ucb/source/ucp/cmis/cmis_url.cxx +++ b/ucb/source/ucp/cmis/cmis_url.cxx @@ -102,8 +102,7 @@ namespace cmis } while ( nPos != -1 ); sUrl += sEncodedPath; - } - if ( !m_sId.isEmpty( ) ) + } else if ( !m_sId.isEmpty( ) ) { sUrl += "#" + rtl::Uri::encode( m_sId, rtl_UriCharClassRelSegment, |