From b0ec6caad14e5221eea42344aae82fbe99f32ff8 Mon Sep 17 00:00:00 2001 From: "Nicholas K. Dionysopoulos" Date: Mon, 22 Jul 2019 20:08:29 +0300 Subject: [PATCH] ~ Better download URLs in XML update streams --- CHANGELOG.md | 4 +++ .../frontend/View/Update/tmpl/stream.php | 35 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 285e5230..e9628ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 4.2.2 +**Other changes** + +* Better download URLs in XML update streams + **Bug fixes** * [HIGH] Cannot change the update stream of an item through the UI diff --git a/component/frontend/View/Update/tmpl/stream.php b/component/frontend/View/Update/tmpl/stream.php index fb1af16e..43fb19d4 100644 --- a/component/frontend/View/Update/tmpl/stream.php +++ b/component/frontend/View/Update/tmpl/stream.php @@ -11,6 +11,8 @@ use Akeeba\ReleaseSystem\Site\Helper\Router; use Akeeba\ReleaseSystem\Site\Helper\Filter; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; $rootURL = rtrim(JURI::base(), '/'); $subpathURL = JURI::base(true); @@ -60,8 +62,8 @@ JFactory::getApplication()->setHeader('X-Akeeba-Expire-After', 300); require_once JPATH_SITE . '/components/com_ars/router.php'; -ComArsRouter::$routeRaw = false; -ComArsRouter::$routeHtml = false; +//ComArsRouter::$routeRaw = false; +//ComArsRouter::$routeHtml = false; $jVersion = new JVersion; @@ -115,12 +117,27 @@ } else { - $format = 'UNSUPPORTED'; + $fileNameParts = explode('.', $basename); + $format = array_pop($fileNameParts); } - if (($format != 'UNSUPPORTED') && ($item->itemtype == 'file')) + if ($item->itemtype == 'file') { - $downloadURL .= '&dummy=my.' . $format; + $dlUri = Uri::getInstance($downloadURL); + + if (Factory::getConfig()->get('sef_suffix', 0) == 1) + { + $pathParts = explode('.', $dlUri->getPath()); + + if ((count($pathParts) > 1) && (array_pop($pathParts) == 'raw')) + { + $dlUri->setPath(implode('.', $pathParts)); + } + } + + $dlUri->setVar('format', 'raw'); + $dlUri->setVar('dummy', 'my.' . $format); + $downloadURL = $dlUri->toString(); } if (!empty($item->environments) && is_array($item->environments)) @@ -194,10 +211,14 @@ type ]; ?> version ?> release_id) ?> + title="cat_title . ' ' . $item->version ?>"> + release_id) ?> + ]]> + + format="">]]> + maturity ?>