From: David A. Velasco Date: Thu, 19 Nov 2015 08:47:23 +0000 (+0100) Subject: Fixed bug: a file already shared with users couldn't be shared via link X-Git-Tag: oc-android-1.9^2~3 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/40d1961e6690df40deb8a1421a1f4a89ac150a95?ds=inline;hp=-c Fixed bug: a file already shared with users couldn't be shared via link --- 40d1961e6690df40deb8a1421a1f4a89ac150a95 diff --git a/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java b/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java index e9cb7d2d..bed23c70 100644 --- a/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java +++ b/src/com/owncloud/android/operations/CreateShareViaLinkOperation.java @@ -41,8 +41,6 @@ import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.resources.shares.ShareType; import com.owncloud.android.operations.common.SyncOperation; -import java.util.ArrayList; - public class CreateShareViaLinkOperation extends SyncOperation { private String mPath; @@ -76,19 +74,19 @@ public class CreateShareViaLinkOperation extends SyncOperation { RemoteOperation operation = new GetRemoteSharesForFileOperation(mPath, false, false); RemoteOperationResult result = operation.execute(client); - boolean shareByLink = false; - // Check if the file is shared by link - if (result.isSuccess() && result.getData().size() > 0){ - ArrayList shares = result.getData(); - for(Object object: shares){ - if (((OCShare) object).getShareType() == ShareType.PUBLIC_LINK){ - shareByLink = true; + // Create public link if doesn't exist yet + boolean publicShareExists = false; + if (result.isSuccess()) { + OCShare share = null; + for (int i=0 ; i