Verify if path exists

We need to check if the path exists and throw an error instead of handling this situation ungraciously.
This commit is contained in:
Lukas Reschke 2015-06-18 16:48:32 +02:00
parent 7a0917e5b2
commit ebb5523698
1 changed files with 4 additions and 0 deletions

View File

@ -83,6 +83,10 @@ if (empty($_POST['dirToken'])) {
// The token defines the target directory (security reasons) // The token defines the target directory (security reasons)
$path = \OC\Files\Filesystem::getPath($linkItem['file_source']); $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
if($path === null) {
OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.')))));
die();
}
$dir = sprintf( $dir = sprintf(
"/%s/%s", "/%s/%s",
$path, $path,