Skip to content
Permalink
Browse files

Fix for ExtractTask does not check output directory (ticket 3852)

  • Loading branch information...
tersmitten committed May 25, 2013
1 parent 9ee6107 commit caec0abcfc003a77378184a15b1d5c5e008a900e
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/Cake/Console/Command/Task/ExtractTask.php
@@ -208,7 +208,7 @@ public function execute() {
if (strtoupper($response) === 'Q') {
$this->out(__d('cake_console', 'Extract Aborted'));
$this->_stop();
} elseif (is_dir($response)) {
} elseif ($this->_isPathUsable($response)) {
$this->_output = $response . DS;
break;
} else {
@@ -229,7 +229,13 @@ public function execute() {
if (empty($this->_files)) {
$this->_searchFiles();
}
$this->_output = rtrim($this->_output, DS) . DS;
if (!$this->_isPathUsable($this->_output)) {
$this->out(__d('cake_console', 'The output directory %s was not found or writable.', $this->_output));
return $this->_stop();
}
$this->_extract();
}
@@ -752,4 +758,13 @@ protected function _isExtractingApp() {
return $this->_paths === array(APP);
}
/**
* Checks whether or not a given path is usable for writing.
*
* @param string $path Path to folder
* @return boolean true if it exists and is writable, false otherwise
*/
protected function _isPathUsable($path) {
return is_dir($path) && is_writable($path);
}
}

0 comments on commit caec0ab

Please sign in to comment.
You can’t perform that action at this time.