From 0b2c9b823c7b421d4305cb25a85074dbde14bc12 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Thu, 21 Nov 2013 17:21:51 +0100
Subject: [PATCH] Prevent using root as mount point for external storage

Fixes #5981
---
 apps/files_external/lib/config.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 4364307651..de42fe2f75 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -266,6 +266,11 @@ class OC_Mount_Config {
 										 $mountType,
 										 $applicable,
 										 $isPersonal = false) {
+		$mountPoint = OC\Files\Filesystem::normalizePath($mountPoint);
+		if ($mountPoint === '' || $mountPoint === '/') {
+			// can't mount at root
+			return false;
+		}
 		if ($isPersonal) {
 			// Verify that the mount point applies for the current user
 			// Prevent non-admin users from mounting local storage
-- 
GitLab