Commit 1f5e994f authored by Thomas Löffler's avatar Thomas Löffler
Browse files

[BUGFIX] Use full url to the distribution images in XML file

parent ee4a40c9
Pipeline #11346 failed with stages
in 3 minutes and 43 seconds
......@@ -16,6 +16,8 @@ use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use T3o\Ter\Api\Configuration;
use T3o\Ter\Exception\InternalServerErrorException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -117,6 +119,13 @@ class ExtensionIndexService implements LoggerAwareInterface
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$extensionsObj = $dom->appendChild(new \DOMElement('extensions'));
$distributionBaseUrl = implode(
'',
[
(string)GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('extensions')->getBase() . '/',
ResourceFactory::getInstance()->getDefaultStorage()->getFolder('ter')->getPublicUrl()
]
);
// Create the nested XML structure:
foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) {
......@@ -144,10 +153,22 @@ class ExtensionIndexService implements LoggerAwareInterface
$distributionImage = $prefixDistributionFilePath . 'Distribution.png';
$distributionWelcomeImage = $prefixDistributionFilePath . 'DistributionWelcome.png';
if (is_file($this->basePath . $distributionImage)) {
$versionObj->appendChild(new \DOMElement('distributionImage', $this->xmlentities($distributionImage)));
$distributionImageUrl = $distributionBaseUrl . $distributionImage;
$versionObj->appendChild(
new \DOMElement(
'distributionImage',
$this->xmlentities($distributionImageUrl)
)
);
}
if (is_file($this->basePath . $distributionWelcomeImage)) {
$versionObj->appendChild(new \DOMElement('distributionImageWelcome', $this->xmlentities($distributionWelcomeImage)));
$distributionWelcomeImageUrl = $distributionBaseUrl . $distributionWelcomeImage;
$versionObj->appendChild(
new \DOMElement(
'distributionImageWelcome',
$this->xmlentities($distributionWelcomeImageUrl)
)
);
}
}
$versionObj->appendChild(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment