From: Michael Gapczynski Date: Thu, 30 Aug 2012 00:40:12 +0000 (-0400) Subject: Check if file source exists before searching for link X-Git-Tag: v4.5.0beta2~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=756b514fee05bdeb9c7fc06876e498837974bb6c;p=nextcloud-server.git Check if file source exists before searching for link --- diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 7f72ef81bd3..010f6b9de18 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -6,9 +6,8 @@ if (isset($_GET['file'])) { $uidOwner = substr($_GET['file'], 1, $pos - 1); if (OCP\User::userExists($uidOwner)) { OC_Util::setupFS($uidOwner); - $file = substr($_GET['file'], $pos); $fileSource = OC_Filecache::getId($_GET['file'], ''); - if ($linkItem = OCP\Share::getItemSharedWithByLink('file', $fileSource, $uidOwner)) { + if ($fileSource != -1 && ($linkItem = OCP\Share::getItemSharedWithByLink('file', $fileSource, $uidOwner))) { if (isset($linkItem['share_with'])) { // Check password if (isset($_POST['password'])) {