diff --git a/controller/btdownloader.php b/controller/btdownloader.php index df1305d..6b087d0 100644 --- a/controller/btdownloader.php +++ b/controller/btdownloader.php @@ -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, diff --git a/controller/ftpdownloader.php b/controller/ftpdownloader.php index cbdad25..80f4ca7 100644 --- a/controller/ftpdownloader.php +++ b/controller/ftpdownloader.php @@ -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)) { diff --git a/controller/httpdownloader.php b/controller/httpdownloader.php index 3ef0b04..26deefb 100644 --- a/controller/httpdownloader.php +++ b/controller/httpdownloader.php @@ -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)) {