From 30df7c33fbaac5db856482e4f72f7b119829dfae Mon Sep 17 00:00:00 2001 From: masensio Date: Fri, 11 Sep 2015 14:48:19 +0200 Subject: [PATCH] Build the share link of a file if it isn't in the response of the server --- .../shares/GetRemoteSharesForFileOperation.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java index 3c53e7f7..45e27769 100644 --- a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java @@ -65,12 +65,14 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation { * Constructor * * @param remoteFilePath Path to file or folder - * @param reshares If set to false (default), only shares from the current user are returned + * @param reshares If set to false (default), only shares from the current user are + * returned * If set to true, all shares from the given file are returned * @param subfiles If set to false (default), lists only the folder being shared * If set to true, all shared files within the folder are returned. */ - public GetRemoteSharesForFileOperation(String remoteFilePath, boolean reshares, boolean subfiles) { + public GetRemoteSharesForFileOperation(String remoteFilePath, boolean reshares, + boolean subfiles) { mRemoteFilePath = remoteFilePath; mReshares = reshares; mSubfiles = subfiles; @@ -113,9 +115,11 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation { result = new RemoteOperationResult(ResultCode.OK); ArrayList sharesObjects = new ArrayList(); for (OCShare share: mShares) { - // Build the link - if (share.getToken().length() > 0) { - share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN + share.getToken()); + // Build the link + if (( share.getShareLink() == null) && + (share.getToken().length() > 0)) { + share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN + + share.getToken()); } sharesObjects.add(share); }