diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-03-18 09:25:04 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-04-02 13:47:11 +0200 |
commit | 850a0e73885779b9768afc1f2a2dd8260b006587 (patch) | |
tree | b0c50ca2e4603be3db68f6dbd0cb1314992639cb /lib/private/share | |
parent | 7bdc08502269f78eb757c492c57584d5b2f52fa8 (diff) | |
download | nextcloud-server-850a0e73885779b9768afc1f2a2dd8260b006587.tar.gz nextcloud-server-850a0e73885779b9768afc1f2a2dd8260b006587.zip |
Verify that a file exists before we share it
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/share.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 7bab98b00bf..74cc8877858 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -431,6 +431,16 @@ class Share extends \OC\Share\Constants { $itemSourceName = $itemSource; } + // verify that the file exists before we try to share it + if ($itemType === 'file' or $itemType === 'folder') { + $path = \OC\Files\Filesystem::getPath($itemSource); + if (!$path) { + $message = 'Sharing ' . $itemSourceName . ' failed, because the file does not exist'; + \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); + throw new \Exception($message); + } + } + // Verify share type and sharing conditions are met if ($shareType === self::SHARE_TYPE_USER) { if ($shareWith == $uidOwner) { |