diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-24 12:32:02 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-24 12:32:02 -0400 |
commit | 365c4fdae24ea9f04f3c92f26182d148a8363776 (patch) | |
tree | 66f320a01c1e9d2070866908bc28b9d18df48fe3 /apps/files_sharing | |
parent | 4c4b1e4c2d7a5ffa2131646d70c495b51b5c9013 (diff) | |
download | nextcloud-server-365c4fdae24ea9f04f3c92f26182d148a8363776.tar.gz nextcloud-server-365c4fdae24ea9f04f3c92f26182d148a8363776.zip |
Allow sharing of files shared with you - Bug: Doesn't show up as being shared in the drop down
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/ajax/share.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php index d9bf4ff7abe..cff0acf3323 100644 --- a/apps/files_sharing/ajax/share.php +++ b/apps/files_sharing/ajax/share.php @@ -4,21 +4,29 @@ $RUNTIME_NOAPPS = true; require_once('../../../lib/base.php'); require_once('../lib_share.php'); +$userDirectory = "/".OC_User::getUser()."/files"; $sources = explode(";", $_POST['sources']); $uid_shared_with = $_POST['uid_shared_with']; $permissions = $_POST['permissions']; foreach ($sources as $source) { + // Make sure file exists and can be shared if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) { - $source = "/".OC_User::getUser()."/files".$source; - try { - $shared = new OC_Share($source, $uid_shared_with, $permissions); - if ($uid_shared_with == OC_Share::PUBLICLINK) { - echo $shared->getToken(); - } - } catch (Exception $exception) { + $source = $userDirectory.$source; + // If the file doesn't exist, it may be shared with the current user + } else { + $source = OC_Share::getSource($userDirectory.$source); + if (!$source) { echo "false"; } } + try { + $shared = new OC_Share($source, $uid_shared_with, $permissions); + if ($uid_shared_with == OC_Share::PUBLICLINK) { + echo $shared->getToken(); + } + } catch (Exception $exception) { + echo "false"; + } } ?>
\ No newline at end of file |