From dd31e5e1b1c9637c077ea3063ec130ff911401d0 Mon Sep 17 00:00:00 2001 From: Oliver Hoff Date: Wed, 30 Jan 2013 13:01:10 +0100 Subject: [PATCH] fix download url generation --- .../MetaModelAttributeFile.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/system/modules/metamodelsattribute_file/MetaModelAttributeFile.php b/src/system/modules/metamodelsattribute_file/MetaModelAttributeFile.php index b69981c..5441b8e 100644 --- a/src/system/modules/metamodelsattribute_file/MetaModelAttributeFile.php +++ b/src/system/modules/metamodelsattribute_file/MetaModelAttributeFile.php @@ -81,6 +81,13 @@ protected function parseMetaFile($strPath) } $this->arrProcessed[] = $strPath; } + + public function getDownloadLink($strFile) { + $strRequest = Environment::getInstance()->request; + $strRequest .= strpos($strRequest, '?') === false ? '?' : '&'; + $strRequest .= 'file=' . urlencode($strFile); + return $strRequest; + } protected function renderFile($strFile, $objSettings, $strId) { @@ -131,8 +138,7 @@ protected function renderFile($strFile, $objSettings, $strId) 'icon' => $strIcon, 'size' => $objFile->filesize, 'sizetext' => sprintf('(%s)', MetaModelController::getReadableSize($objFile->filesize, 2)), - 'url' => Environment::getInstance()->request . (($GLOBALS['TL_CONFIG']['disableAlias'] || !$GLOBALS['TL_CONFIG']['rewriteURL'] -&& count($_GET) || strlen($_GET['page'])) ? '&' : '?'). 'file=' . MetaModelController::urlEncode($strFile) + 'url' => specialchars($this->getDownloadLink($strFile)) ); // images