From: masensio Date: Thu, 20 Mar 2014 14:35:23 +0000 (+0100) Subject: Changes from comments in PR#442, in oc-project X-Git-Tag: oc-android-1.5.5~5^2~6^2~1 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/3064f1fc4be8a6af92ba6454690bfcd54977a54f?hp=-c Changes from comments in PR#442, in oc-project --- 3064f1fc4be8a6af92ba6454690bfcd54977a54f diff --git a/owncloud-android-library b/owncloud-android-library index ff4dd08d..d8fd024f 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit ff4dd08dd5ac79ef2ce200d033182773f9dc36b1 +Subproject commit d8fd024f2adde05ceab2cb41fdcf72d9c2a9d6f5 diff --git a/src/com/owncloud/android/operations/CreateShareOperation.java b/src/com/owncloud/android/operations/CreateShareOperation.java index 17151abf..896ecca7 100644 --- a/src/com/owncloud/android/operations/CreateShareOperation.java +++ b/src/com/owncloud/android/operations/CreateShareOperation.java @@ -43,8 +43,6 @@ public class CreateShareOperation extends SyncOperation { private static final String TAG = CreateShareOperation.class.getSimpleName(); - // String to build the link with the token of a share: server address + "/public.php?service=files&t=" + token - private final String SHARING_LINK_TOKEN = "/public.php?service=files&t="; protected FileDataStorageManager mStorageManager; @@ -94,25 +92,18 @@ public class CreateShareOperation extends SyncOperation { operation = new GetRemoteSharesForFileOperation(mPath, false, false); RemoteOperationResult result = ((GetRemoteSharesForFileOperation)operation).execute(client); + if (!result.isSuccess() || result.getData().size() <= 0) { + operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions); + result = ((CreateRemoteShareOperation)operation).execute(client); + } + if (result.isSuccess()) { if (result.getData().size() > 0) { OCShare share = (OCShare) result.getData().get(0); - // Update the link, build it with the token: server address + "/public.php?service=files&t=" + token - share.setShareLink(client.getBaseUri() + SHARING_LINK_TOKEN + share.getToken()); - Log_OC.d(TAG, "Build Share link= " + share.getShareLink()); updateData(share); - } else { - operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions); - result = ((CreateRemoteShareOperation)operation).execute(client); - - if (result.isSuccess()) { - if (result.getData().size() > 0) { - OCShare share = (OCShare) result.getData().get(0); - updateData(share); - } - } - } + } } + return result; }