-
- // Update DB with the response
- if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) {
- share.setPath(mPath.substring(0, mPath.length()-1));
- share.setIsFolder(true);
-
- } else {
- share.setPath(mPath);
- share.setIsFolder(false);
- }
- share.setPermissions(mPermissions);
-
- getStorageManager().saveShare(share);
-
- // Update OCFile with data from share: ShareByLink and publicLink
- OCFile file = getStorageManager().getFileByPath(mPath);
- if (file!=null) {
- mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
- file.setPublicLink(share.getShareLink());
- file.setShareByLink(true);
- getStorageManager().saveFile(file);
- Log_OC.d(TAG, "Public Link = " + file.getPublicLink());
-
+ // 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);
+ }