diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-07-08 14:44:09 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-07-08 14:45:19 +0200 |
commit | f3c687a87c4c238286c35adcec54592c2e8cdffa (patch) | |
tree | 5a92cbd699ab75cfd1133aafed2598f5574e467c /external | |
parent | f0c4130746e7b61029ce90f24e69a3203b547e54 (diff) |
tdf#90351: server response does not always contain cmis:baseTypeId
So if we know which object we just created, don't rely on the server
response to tell us. Improvement on the fix from
5c10e8cd0eedefc2dcc905154c4daa142561aef3.
Change-Id: Iddf706fb3b8bef38217a406c806963ba4496c7c9
Diffstat (limited to 'external')
-rw-r--r-- | external/libcmis/tdf90351.patch | 111 |
1 files changed, 105 insertions, 6 deletions
diff --git a/external/libcmis/tdf90351.patch b/external/libcmis/tdf90351.patch index fe0e5c55d3c0..65d630af0353 100644 --- a/external/libcmis/tdf90351.patch +++ b/external/libcmis/tdf90351.patch @@ -1,10 +1,109 @@ +From 2b85882048847a3d2076a8ac0ed63d905aeea1dd Mon Sep 17 00:00:00 2001 +From: Thorsten Behrens <Thorsten.Behrens@CIB.de> +Date: Wed, 8 Jul 2015 14:26:01 +0200 +Subject: [PATCH] tdf#90351: response does not always contain cmis:baseTypeId + +So if we know which object we just created, don't rely on the server +response to tell us. +--- + src/libcmis/atom-document.cxx | 4 ++-- + src/libcmis/atom-folder.cxx | 4 ++-- + src/libcmis/atom-session.cxx | 6 +++--- + src/libcmis/atom-session.hxx | 3 ++- + 4 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/src/libcmis/atom-document.cxx b/src/libcmis/atom-document.cxx +index b7f28b3..49cfd45 100644 +--- src/libcmis/atom-document.cxx ++++ src/libcmis/atom-document.cxx +@@ -280,7 +280,7 @@ libcmis::DocumentPtr AtomDocument::checkOut( ) throw ( libcmis::Exception ) + if ( NULL == doc ) + throw libcmis::Exception( "Failed to parse object infos" ); + +- libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc ); ++ libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc, AtomPubSession::RESULT_DOCUMENT ); + xmlFreeDoc( doc ); + + libcmis::DocumentPtr pwc = boost::dynamic_pointer_cast< libcmis::Document >( created ); +@@ -377,7 +377,7 @@ libcmis::DocumentPtr AtomDocument::checkIn( bool isMajor, string comment, + throw libcmis::Exception( "Failed to parse object infos" ); + + +- libcmis::ObjectPtr newVersion = getSession( )->createObjectFromEntryDoc( doc ); ++ libcmis::ObjectPtr newVersion = getSession( )->createObjectFromEntryDoc( doc, AtomPubSession::RESULT_DOCUMENT ); + + if ( newVersion->getId( ) == getId( ) ) + refreshImpl( doc ); +diff --git a/src/libcmis/atom-folder.cxx b/src/libcmis/atom-folder.cxx +index 7947883..55ac2a9 100644 +--- src/libcmis/atom-folder.cxx ++++ src/libcmis/atom-folder.cxx +@@ -170,7 +170,7 @@ libcmis::FolderPtr AtomFolder::createFolder( const PropertyPtrMap& properties ) + if ( NULL == doc ) + throw libcmis::Exception( "Failed to parse object infos" ); + +- libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc ); ++ libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc, AtomPubSession::RESULT_FOLDER ); + xmlFreeDoc( doc ); + + libcmis::FolderPtr newFolder = boost::dynamic_pointer_cast< libcmis::Folder >( created ); +@@ -244,7 +244,7 @@ libcmis::DocumentPtr AtomFolder::createDocument( const PropertyPtrMap& propertie + throw libcmis::Exception( "Missing expected response from server" ); + } + +- libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc ); ++ libcmis::ObjectPtr created = getSession( )->createObjectFromEntryDoc( doc, AtomPubSession::RESULT_DOCUMENT ); + xmlFreeDoc( doc ); + + libcmis::DocumentPtr newDocument = boost::dynamic_pointer_cast< libcmis::Document >( created ); +diff --git a/src/libcmis/atom-session.cxx b/src/libcmis/atom-session.cxx +index ffa93a7..e470884 100644 --- src/libcmis/atom-session.cxx +++ src/libcmis/atom-session.cxx -@@ -233,6 +233,7 @@ libcmis::ObjectPtr AtomPubSession::createObjectFromEntryDoc( xmlDocPtr doc ) - else +@@ -201,7 +201,7 @@ bool AtomPubSession::setRepository( string repositoryId ) + return found; + } + +-libcmis::ObjectPtr AtomPubSession::createObjectFromEntryDoc( xmlDocPtr doc ) ++libcmis::ObjectPtr AtomPubSession::createObjectFromEntryDoc( xmlDocPtr doc, ResultObjectType res ) + { + libcmis::ObjectPtr cmisObject; + +@@ -222,11 +222,11 @@ libcmis::ObjectPtr AtomPubSession::createObjectFromEntryDoc( xmlDocPtr doc ) + string baseType = libcmis::getXPathValue( xpathCtx, baseTypeReq ); + + xmlNodePtr node = xpathObj->nodesetval->nodeTab[0]; +- if ( baseType == "cmis:folder" ) ++ if ( res == RESULT_FOLDER || baseType == "cmis:folder" ) { - // Not a valid CMIS atom entry... weird -+ cmisObject.reset( new AtomDocument( this, node ) ); + cmisObject.reset( new AtomFolder( this, node ) ); } - } - xmlXPathFreeObject( xpathObj ); +- else if ( baseType == "cmis:document" ) ++ else if ( res == RESULT_DOCUMENT || baseType == "cmis:document" ) + { + cmisObject.reset( new AtomDocument( this, node ) ); + } +diff --git a/src/libcmis/atom-session.hxx b/src/libcmis/atom-session.hxx +index c887b6d..953aa17 100644 +--- src/libcmis/atom-session.hxx ++++ src/libcmis/atom-session.hxx +@@ -37,6 +37,7 @@ class AtomPubSession : public BaseSession + AtomRepositoryPtr m_repository; + + public: ++ enum ResultObjectType { RESULT_DYNAMIC, RESULT_FOLDER, RESULT_DOCUMENT }; + AtomPubSession( std::string sAtomPubUrl, std::string repositoryId, + std::string username, std::string password, bool noSslCheck = false, + libcmis::OAuth2DataPtr oauth2 = libcmis::OAuth2DataPtr(), +@@ -58,7 +59,7 @@ class AtomPubSession : public BaseSession + + // Utility methods + +- libcmis::ObjectPtr createObjectFromEntryDoc( xmlDocPtr doc ); ++ libcmis::ObjectPtr createObjectFromEntryDoc( xmlDocPtr doc, ResultObjectType res=RESULT_DYNAMIC ); + + std::vector< libcmis::ObjectTypePtr > getChildrenTypes( std::string url ) + throw ( libcmis::Exception ); +-- +2.1.4 + |