[Pkg-owncloud-commits] [owncloud] 43/55: Verify that a file exists before we share it

David Prévot taffit at moszumanska.debian.org
Wed Apr 23 19:52:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.16RC1
in repository owncloud.

commit 2264615d207c38f6daa6a72b7285e99cbf551038
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Apr 17 12:38:58 2014 +0200

    Verify that a file exists before we share it
---
 lib/public/share.php | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/public/share.php b/lib/public/share.php
index 359a328..75f8512 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -391,6 +391,17 @@ class Share {
 	public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions) {
 		$uidOwner = \OC_User::getUser();
 		$sharingPolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
+
+		// 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 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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list