From ee726119cb21ac07c17857cb1a81baa262bf42da Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Wed, 26 Apr 2017 13:48:22 +0200 Subject: [PATCH] Clarify absence and patch of URL field of OCShares --- .../shares/ShareToRemoteOperationResultParser.java | 6 +++--- .../android/lib/resources/shares/ShareXMLParser.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.java b/src/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.java index c39300f8..3b37c035 100644 --- a/src/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.java +++ b/src/com/owncloud/android/lib/resources/shares/ShareToRemoteOperationResultParser.java @@ -88,18 +88,18 @@ public class ShareToRemoteOperationResultParser { if (shares != null) { for (OCShare share : shares) { resultData.add(share); - // build the share link if not in the response (only received when the share is created) + // build the share link if not in the response + // (needed for OC servers < 9.0.0, see ShareXMLParser.java#line256) if (share.getShareType() == ShareType.PUBLIC_LINK && (share.getShareLink() == null || share.getShareLink().length() <= 0) && share.getToken().length() > 0 ) { - // TODO - deal with https://github.com/owncloud/android/issues/1811 if (mServerBaseUri != null) { String sharingLinkPath = ShareUtils.getSharingLinkPath(mOwnCloudVersion); share.setShareLink(mServerBaseUri + sharingLinkPath + share.getToken()); } else { - Log_OC.e(TAG, "Couldn't build link for public share"); + Log_OC.e(TAG, "Couldn't build link for public share :("); } } } diff --git a/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java b/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java index 0f02e6f3..70891a4f 100644 --- a/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java +++ b/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java @@ -253,6 +253,9 @@ public class ShareXMLParser { share.setIdRemoteShared(Integer.parseInt(value)); } else if (name.equalsIgnoreCase(NODE_URL)) { + // NOTE: this field is received in all the public shares from OC 9.0.0 + // in previous versions, it's received in the result of POST requests, but not + // in GET requests share.setShareType(ShareType.PUBLIC_LINK); String value = readNode(parser, NODE_URL); share.setShareLink(value);