check if file really exist before add/remove it
This commit is contained in:
parent
a56f2ec183
commit
aa9ffd119a
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
OCP\JSON::checkAppEnabled('files_external');
|
OCP\JSON::checkAppEnabled('files_external');
|
||||||
|
|
||||||
|
if ( !($filename = $_FILES['rootcert_import']['name']) ) {
|
||||||
|
header("Location: settings/personal.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r');
|
$fh = fopen($_FILES['rootcert_import']['tmp_name'], 'r');
|
||||||
$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name']));
|
$data = fread($fh, filesize($_FILES['rootcert_import']['tmp_name']));
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
|
@ -5,7 +5,10 @@ OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::callCheck();
|
OCP\JSON::callCheck();
|
||||||
|
|
||||||
$view = \OCP\Files::getStorage("files_external");
|
$view = \OCP\Files::getStorage("files_external");
|
||||||
$cert = ltrim($_POST['cert'], "/\\.");
|
$file = 'uploads/'.ltrim($_POST['cert'], "/\\.");
|
||||||
$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'.$cert;
|
|
||||||
unlink($file);
|
if ( $view->file_exists($file) ) {
|
||||||
OC_Mount_Config::createCertificateBundle();
|
$view->unlink($file);
|
||||||
|
OC_Mount_Config::createCertificateBundle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue