summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2016-08-08 21:29:09 +1000
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2016-08-10 10:05:13 +0000
commit027227f5f7672f30a45b17d4f5d12e66eb36876b (patch)
treede4fee3d3740aa7c1a86b3c568d8bbcaacbffbdc /external
parent5043795621f25047e166f112821d1f899252f7ce (diff)
tdf#101385: don't try to get SharePoint folder outside of allowed range
for a given site. This patch uses the fact that getFolderByServerRelativeUrl API returns site's root folder if used with empty path (''). Hopefully this isn't otherwise context-dependent, so that it doesn't return other folders in some unknown circumstances. More correct would be instead to use the site's root path directly, like '/sites/mysite'. But I don't know a reliable way to filter the API part from the base URI. To make use of the corrected SharePoint repository root id, the patch also redirects all cases where "/" object is queried, to session's getRootFolder(). libcmis part of the patch will hopefully soon be merged upstream. Change-Id: I0f3b9930748de3fe4763eb27721739f097b9892d Reviewed-on: https://gerrit.libreoffice.org/27987 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com> (cherry picked from commit 1b482aec4e7b6aec86fb20bcda555c4060a80332) Reviewed-on: https://gerrit.libreoffice.org/28011 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'external')
-rw-r--r--external/libcmis/UnpackedTarball_cmis.mk1
-rw-r--r--external/libcmis/libcmis-sharepoint-repository-root.patch24
2 files changed, 25 insertions, 0 deletions
diff --git a/external/libcmis/UnpackedTarball_cmis.mk b/external/libcmis/UnpackedTarball_cmis.mk
index bd66e2efeb5e..8fb247fb87aa 100644
--- a/external/libcmis/UnpackedTarball_cmis.mk
+++ b/external/libcmis/UnpackedTarball_cmis.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,cmis, \
external/libcmis/libcmis-libxml2_compatibility.patch \
external/libcmis/libcmis-fix-google-drive.patch \
external/libcmis/libcmis-google-2FA-implementation.patch \
+ external/libcmis/libcmis-sharepoint-repository-root.patch \
))
ifeq ($(OS)$(COM),WNTMSC)
diff --git a/external/libcmis/libcmis-sharepoint-repository-root.patch b/external/libcmis/libcmis-sharepoint-repository-root.patch
new file mode 100644
index 000000000000..f89b134cc7a4
--- /dev/null
+++ b/external/libcmis/libcmis-sharepoint-repository-root.patch
@@ -0,0 +1,24 @@
+diff --git a/src/libcmis/sharepoint-repository.cxx b/src/libcmis/sharepoint-repository.cxx
+index 780624d..f992689 100644
+--- a/src/libcmis/sharepoint-repository.cxx
++++ b/src/libcmis/sharepoint-repository.cxx
+@@ -35,7 +35,18 @@ SharePointRepository::SharePointRepository( std::string baseUrl ) :
+ m_description = "SharePoint repository";
+ m_productName = "SharePoint";
+ m_productVersion = "2010/2013";
+- m_rootId = baseUrl + "/getFolderByServerRelativeUrl('/')";
++ // getFolderByServerRelativeUrl() API expects path to be
++ // *server-relative*, i.e. they must include site path.
++ // Given the baseUrl like "https://sp2013/sites/mysite/_api/Web"
++ // for a site "mysite" on sharepoint server "sp2013",
++ // the site root is '/sites/mysite/', not '/'.
++ // Trying to get folder '/' results in "Value does not fall
++ // within expected range" error.
++ // Preferrable here is to extract the root path from baseUrl,
++ // stripping server and api parts. But it can be unreliable
++ // if api part (_api/Web) is different for some server.
++ // On the other side, just querying empty path '' gives the root folder.
++ m_rootId = baseUrl + "/getFolderByServerRelativeUrl('')";
+
+ m_capabilities[ ACL ] = "discover";
+ m_capabilities[ AllVersionsSearchable ] = "true";