Browse files

Fixing bug#4659 - don't make upload directories unless there's someth…

…ing to save
  • Loading branch information...
1 parent 17b0483 commit 50c38beb534edf212bacdf814ade6db2519ed0e7 mjollnir_ committed Feb 1, 2006
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/uploadlib.php
View
7 lib/uploadlib.php
@@ -141,6 +141,7 @@ function preprocess_files() {
}
$this->files[$name]['name'] = $newname;
$this->files[$name]['clear'] = true; // ok to save.
+ $this->config->somethingtosave = true;
}
}
}
@@ -186,6 +187,12 @@ function save_files($destination) {
if (!$this->status) { // preprocess_files hasn't been run
$this->preprocess_files();
}
+
+ // if there are no files, bail before we create an empty directory.
+ if (empty($this->config->somethingtosave)) {
+ return true;
+ }
+
if ($this->status) {
if (!(strpos($destination, $CFG->dataroot) === false)) {
// take it out for giving to make_upload_directory

0 comments on commit 50c38be

Please sign in to comment.