From bae3c4fc5c82496561d2b156765ebf2257973437 Mon Sep 17 00:00:00 2001 From: Cao Cuong Ngo Date: Sat, 21 Sep 2013 23:36:06 +0200 Subject: 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. Change-Id: I6985feec71dc23848ee022e0bab9e8515a21ffd2 --- comphelper/source/misc/mediadescriptor.cxx | 3 +-- sfx2/source/doc/docfile.cxx | 5 +++-- ucb/source/ucp/cmis/cmis_content.cxx | 14 ++++++++------ ucb/source/ucp/cmis/cmis_url.cxx | 3 +-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 21102f2a773d..5ac52ca0f8f4 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -470,8 +470,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 + OUString sNormalizedURL = impl_normalizeURL( sURL ); return impl_openStreamWithURL( sURL, bLockFile ); } #if OSL_DEBUG_LEVEL > 0 diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index ebd03eaf3284..c59675f8d5c5 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2492,7 +2492,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() ) ); } @@ -3007,7 +3007,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 76d23b93da6e..685cd4b9a029 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1222,8 +1222,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(); } } @@ -1501,10 +1499,14 @@ namespace cmis return parentUrl; else { - INetURLObject aParentUrl( m_sURL ); - string sName = OUSTR_TO_STDSTR( aParentUrl.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ) ); - 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; diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx index 24680661e913..a30aeffa8b61 100644 --- a/ucb/source/ucp/cmis/cmis_url.cxx +++ b/ucb/source/ucp/cmis/cmis_url.cxx @@ -105,8 +105,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, -- cgit v1.2.3