summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/ajax')
-rw-r--r--apps/files/ajax/delete.php7
-rw-r--r--apps/files/ajax/list.php2
-rw-r--r--apps/files/ajax/newfile.php9
3 files changed, 10 insertions, 8 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
index 61caa7618da..1a810f6954c 100644
--- a/apps/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -36,7 +36,12 @@ foreach ($files as $file) {
}
// get array with updated storage stats (e.g. max file size) after upload
-$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
+try {
+ $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
+} catch(\OCP\Files\NotFoundException $e) {
+ OCP\JSON::error(['data' => ['message' => 'File not found']]);
+ return;
+}
if ($success) {
OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index 4aed79d70f7..b590776830a 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -5,7 +5,7 @@ OCP\JSON::checkLoggedIn();
$l = \OC::$server->getL10N('files');
// Load the files
-$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
+$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
$dir = \OC\Files\Filesystem::normalizePath($dir);
try {
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index 0eb144aca56..159a8b5d7a3 100644
--- a/apps/files/ajax/newfile.php
+++ b/apps/files/ajax/newfile.php
@@ -3,9 +3,8 @@
// Init owncloud
global $eventSource;
-if(!OC_User::isLoggedIn()) {
- exit;
-}
+\OCP\JSON::checkLoggedIn();
+\OCP\JSON::callCheck();
\OC::$server->getSession()->close();
@@ -17,8 +16,6 @@ $source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : '';
if($source) {
$eventSource = \OC::$server->createEventSource();
-} else {
- OC_JSON::callCheck();
}
function progress($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
@@ -138,7 +135,7 @@ if($source) {
}
}
}
- $result=\OC\Files\Filesystem::file_put_contents($target, $sourceStream);
+ $result = \OC\Files\Filesystem::file_put_contents($target, $sourceStream);
}
if($result) {
$meta = \OC\Files\Filesystem::getFileInfo($target);