summaryrefslogtreecommitdiffstats
path: root/apis
diff options
context:
space:
mode:
authorSimon Rettberg2014-01-31 16:23:11 +0100
committerSimon Rettberg2014-01-31 16:23:11 +0100
commitdd4a925013c92011b5c57976c97eb0fa8c7c22d0 (patch)
treeea53da9b4eb96e6a810b02c564160c0e117069a5 /apis
parentAdd pagination to syslog, change filter inputbox to use tagsinput (diff)
downloadslx-admin-dd4a925013c92011b5c57976c97eb0fa8c7c22d0.tar.gz
slx-admin-dd4a925013c92011b5c57976c97eb0fa8c7c22d0.tar.xz
slx-admin-dd4a925013c92011b5c57976c97eb0fa8c7c22d0.zip
Show error if download for a file is requested that is not writable
Diffstat (limited to 'apis')
-rw-r--r--apis/download.inc.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apis/download.inc.php b/apis/download.inc.php
index b9033c6f..898e34ff 100644
--- a/apis/download.inc.php
+++ b/apis/download.inc.php
@@ -35,7 +35,7 @@ if (isset($_REQUEST['progress'])) {
}
}
fclose($fh);
- if ($error === false && $pid > 0 && $percent != 100 && !posix_kill($pid, 0)) $error = 'Process died - ' . $line;
+ if ($error === false && $pid > 0 && $percent != 100 && !posix_kill($pid, 0)) $error = "Process $pid died - " . file_get_contents($log);
if ($error !== false) {
echo Render::parse('download-error', array('file' => $file, 'code' => $error));
unlink($log);
@@ -80,6 +80,11 @@ if (file_exists($local . '/' . $file) && !$overwrite) {
exit(0);
}
+if (file_exists($local . '/' . $file) && !is_writable($local . '/' . $file)) {
+ echo Render::parse('download-error', array('file' => $local . '/' . $file, 'remote' => $remote, 'code' => 'Local file is not writable'));
+ exit(0);
+}
+
if ($directExec) {
// Blocking inline download
$ret = Util::downloadToFile($local . '/' . $file, $remote . '/' . $file, 20, $code);