+ if (result.getData().size() > 0) {
+ OCShare share = (OCShare) result.getData().get(0);
+
+ // Update DB with the response
+ if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) {
+ share.setPath(mPath.substring(0, mPath.length()-1));
+ share.setIsDirectory(true);
+
+ } else {
+ share.setPath(mPath);
+ share.setIsDirectory(false);
+ }
+ share.setPermissions(mPermissions);
+
+ getStorageManager().saveShare(share);
+
+ // Update OCFile with data from share: ShareByLink and publicLink
+ OCFile file = getStorageManager().getFileByPath(mPath);
+ if (file!=null) {
+ file.setPublicLink(share.getShareLink());
+ getStorageManager().saveFile(file);
+ Log_OC.d(TAG, "Public Link = " + file.getPublicLink());
+
+ }
+ }