1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Build the share link of a file if it isn't in the response of the server

This commit is contained in:
masensio 2015-09-11 14:48:19 +02:00
parent 17bb724b42
commit 30df7c33fb

View File

@ -65,12 +65,14 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
* Constructor * Constructor
* *
* @param remoteFilePath Path to file or folder * @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 * 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 * @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. * 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; mRemoteFilePath = remoteFilePath;
mReshares = reshares; mReshares = reshares;
mSubfiles = subfiles; mSubfiles = subfiles;
@ -113,9 +115,11 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
result = new RemoteOperationResult(ResultCode.OK); result = new RemoteOperationResult(ResultCode.OK);
ArrayList<Object> sharesObjects = new ArrayList<Object>(); ArrayList<Object> sharesObjects = new ArrayList<Object>();
for (OCShare share: mShares) { for (OCShare share: mShares) {
// Build the link // Build the link
if (share.getToken().length() > 0) { if (( share.getShareLink() == null) &&
share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN + share.getToken()); (share.getToken().length() > 0)) {
share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN +
share.getToken());
} }
sharesObjects.add(share); sharesObjects.add(share);
} }