Verify that a file exists before we share it

This commit is contained in:
Robin Appelman 2014-04-17 12:32:52 +02:00
parent cf2fc58c65
commit d4be12ab21

View file

@ -475,6 +475,16 @@ class Share {
$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) {