Skip to content

Commit

Permalink
Merge branch 'master' of github.com:e-alfred/ocdownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
e-alfred committed Sep 19, 2017
2 parents 22b0068 + e0a3da6 commit 225f4f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion controller/btdownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public function add()
throw new \Exception((string)$this->L10N->t('You are not allowed to use the BitTorrent protocol'));
}

$Target = Tools::cleanString(str_replace('.torrent', '', $_POST['FILE']));
$Target=parse_url($_POST['FILE'], PHP_URL_PATH);
$Target = Tools::cleanString(str_replace('.torrent', '', $Target));

$OPTIONS = array(
'dir' => rtrim($this->AbsoluteDownloadsFolder, '/').'/'.$Target,
Expand Down
3 changes: 2 additions & 1 deletion controller/ftpdownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public function add()
throw new \Exception((string)$this->L10N->t('You are not allowed to use the FTP protocol'));
}

$Target = Tools::cleanString(substr($_POST['FILE'], strrpos($_POST['FILE'], '/') + 1));
$Target=parse_url($_POST['FILE'], PHP_URL_PATH);
$Target = Tools::cleanString(substr($Target, strrpos($Target, '/') + 1));

// If target file exists, create a new one
if (\OC\Files\Filesystem::file_exists($this->DownloadsFolder . '/' . $Target)) {
Expand Down
3 changes: 2 additions & 1 deletion controller/httpdownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public function add()
throw new \Exception((string)$this->L10N->t('You are not allowed to use the HTTP protocol'));
}

$Target = Tools::cleanString(substr($_POST['FILE'], strrpos($_POST['FILE'], '/') + 1));
$Target=parse_url($_POST['FILE'], PHP_URL_PATH);
$Target = Tools::cleanString(substr($Target, strrpos($Target, '/') + 1));

// If target file exists, create a new one
if (\OC\Files\Filesystem::file_exists($this->DownloadsFolder . '/' . $Target)) {
Expand Down

0 comments on commit 225f4f7

Please sign in to comment.