[Libreoffice-commits] core.git: 2 commits - comphelper/source sfx2/source ucb/source
Cao Cuong Ngo
cao.cuong.ngo at gmail.com
Thu Sep 26 07:16:10 PDT 2013
comphelper/source/misc/mediadescriptor.cxx | 21 ++++++++++++++++++---
sfx2/source/doc/docfile.cxx | 5 +++--
ucb/source/ucp/cmis/cmis_content.cxx | 25 ++++++++++++++++++++-----
ucb/source/ucp/cmis/cmis_url.cxx | 3 +--
4 files changed, 42 insertions(+), 12 deletions(-)
New commits:
commit 86218bda0d74fc5bfc877b5c12d594d527207b11
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Thu Sep 26 16:13:18 2013 +0200
Fix fdo#68894 Cmis crashes on start up.
The reason of the crash is that the recent file opening
feature can't get the session automatically.
Change-Id: I6890c04cfdafc81d19c6b2b2024896df040fe091
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 48556ed..0022a8a 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -364,6 +364,17 @@ namespace cmis
libcmis::ObjectPtr Content::getObject( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw ( libcmis::Exception )
{
+ // can't get the session for some reason
+ // the recent file openning at start up is an example.
+ try
+ {
+ if ( !getSession( xEnv ) )
+ return m_pObject;
+ }
+ catch ( uno::RuntimeException& )
+ {
+ return m_pObject;
+ }
if ( !m_pObject.get() )
{
if ( !m_sObjectId.isEmpty( ) )
commit 34f4d2574987b272681b5843e8f5edc374f55fde
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Sat Sep 21 23:36:06 2013 +0200
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
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 7fd7d5f..21361f5 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 710ea5f..329cfb8 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 4bc7c3c..48556ed 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 5c0a926a..b6dbf6c 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,
More information about the Libreoffice-commits
mailing list