diff --git a/apps/files_external/ajax/removeRootCertificate.php b/apps/files_external/ajax/removeRootCertificate.php
index 9b78e180d9ea01596e8efff0c2223a74b1ac85e7..f87d4a56308d9ed9c28e521c303a2bf12f76f2c7 100644
--- a/apps/files_external/ajax/removeRootCertificate.php
+++ b/apps/files_external/ajax/removeRootCertificate.php
@@ -5,7 +5,7 @@ OCP\JSON::checkLoggedIn();
 OCP\JSON::callCheck();
 
 $view = \OCP\Files::getStorage("files_external");
-$cert = $_POST['cert'];
+$cert = ltrim($_POST['cert'], "/.");
 $file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'.$cert;
 unlink($file);
 OC_Mount_Config::createCertificateBundle();