summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2014-04-15 11:23:17 +0200
committerBjörn Schießle <schiessle@owncloud.com>2014-04-15 11:23:17 +0200
commit2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3 (patch)
tree58783d31bf04451896d0cbe0b83edb889481e2d5 /lib
parent1ea8b644b63fe48dbb515b2fdc960225804de068 (diff)
parent7dafdfbe88e713a3f3e03e142679fd840deed494 (diff)
downloadnextcloud-server-2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3.tar.gz
nextcloud-server-2dbb2db7e0ca1e1f5c32de4b6e47c0c9c870acc3.zip
Merge pull request #7780 from owncloud/share-file-exists
Verify that a file exists before we share it
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/share.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 3bc07b43b4c..d4f08e8e016 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) {