From 070fe02448ca0c6c1cc9104c5dc47814b9dd05d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= <schiessle@owncloud.com>
Date: Wed, 24 Oct 2012 10:04:19 +0200
Subject: [PATCH] calling OC_Filesystem at this point will initialize file
 system with wrong user (for public shared links if another user is logged
 in). Therefore remove trailing slashes without the help of OC_Filesystem.

---
 apps/files_sharing/public.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 59385dd6868..ba3338febd7 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -24,12 +24,18 @@ if (isset($_GET['token'])) {
 if (isset($_GET['file']) || isset($_GET['dir'])) {
 	if (isset($_GET['dir'])) {
 		$type = 'folder';
-		$path = OC_Filesystem::normalizePath($_GET['dir']);
+		$path = $_GET['dir'];
+		if(strlen($path)>1 and substr($path,-1,1)==='/') {
+			$path=substr($path,0,-1);
+		}
 		$baseDir = $path;
 		$dir = $baseDir;
 	} else {
 		$type = 'file';
-		$path = OC_Filesystem::normalizePath($_GET['file']);
+		$path = $_GET['dir'];
+		if(strlen($path)>1 and substr($path,-1,1)==='/') {
+			$path=substr($path,0,-1);
+		}
 	}
 	$uidOwner = substr($path, 1, strpos($path, '/', 1) - 1);
 	if (OCP\User::userExists($uidOwner)) {
-- 
GitLab