Skip to content

add support for redirect on installer helper #1559

Merged
merged 2 commits into from Oct 4, 2012
View
8 libraries/joomla/installer/helper.php
@@ -46,13 +46,17 @@ public static function downloadPackage($url, $target = false)
$http = JHttpFactory::getHttp();
$response = $http->get($url);
- if (200 != $response->code)
+ if (302 == $response->code && isset($response->headers['Location']))
+ {
+ return self::downloadPackage($response->headers['Location']);
+ }
+ elseif (200 != $response->code)
{
JLog::add(JText::_('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_CONNECT'), JLog::WARNING, 'jerror');
return false;
}
- if ($response->headers['wrapper_data']['Content-Disposition'])
+ if (isset($response->headers['wrapper_data']['Content-Disposition']))
{
$contentfilename = explode("\"", $response->headers['wrapper_data']['Content-Disposition']);
$target = $contentfilename[1];
Something went wrong with that request. Please try again.