From 51321526e2540de455b0757b884bc7967cf0eec8 Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <mtgap@owncloud.com>
Date: Wed, 3 Oct 2012 16:14:34 -0400
Subject: [PATCH] Prevent displaying errors if public link url parameters are
 incorrect

---
 apps/files_sharing/public.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 15377680ab..59755fe693 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -36,6 +36,13 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
 		OC_Util::setupFS($uidOwner);
 		$fileSource = OC_Filecache::getId($path, '');
 		if ($fileSource != -1 && ($linkItem = OCP\Share::getItemSharedWithByLink($type, $fileSource, $uidOwner))) {
+			// TODO Fix in the getItems
+			if (!isset($linkItem['item_type']) || $linkItem['item_type'] != $type) {
+				header('HTTP/1.0 404 Not Found');
+				$tmpl = new OCP\Template('', '404', 'guest');
+				$tmpl->printPage();
+				exit();
+			}
 			if (isset($linkItem['share_with'])) {
 				// Check password
 				if (isset($_POST['password'])) {
-- 
GitLab