From a8155cbc1cc1faef319fdaa3f1c9abc2e14c7939 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <bfr@qbus.de> Date: Tue, 14 Apr 2020 13:45:11 +0200 Subject: [PATCH] [BUGFIX] Fix extension scanner Index.rst filename parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rst files may not contain issue numbers. The extension scanner iterates all .rst files (including Index.rst) which cases a type error for typo3/sysext/core/Documentation/Changelog/7.0/Index.rst (1/1) TypeError Return value of TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile::parseIssueId() must be of the type string, null returned Releases: master, 9.5 Resolves: #91027 Related: #90923 Change-Id: I000675700f9da17f063ccbc52d6ce0beabebf247 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64161 Tested-by: Josef Glatz <josefglatz@gmail.com> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Josef Glatz <josefglatz@gmail.com> Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> --- .../Classes/UpgradeAnalysis/DocumentationFile.php | 14 +++++++------- .../Partials/Upgrade/UpgradeDocs/PanelItem.html | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php index f25992dfa1ed..9794ff851032 100644 --- a/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php +++ b/typo3/sysext/install/Classes/UpgradeAnalysis/DocumentationFile.php @@ -154,10 +154,10 @@ class DocumentationFile $entry['filename'] ); } - $entry['url']['issue'] = sprintf( - 'https://forge.typo3.org/issues/%s', - $this->parseIssueId($entry['filename']) - ); + $issueId = $this->parseIssueId($entry['filename']); + if ($issueId) { + $entry['url']['issue'] = sprintf('https://forge.typo3.org/issues/%s', $issueId); + } return [md5($file) => $entry]; } @@ -349,11 +349,11 @@ class DocumentationFile /** * @param string $filename * - * @return string + * @return string|null */ - protected function parseIssueId(string $filename): string + protected function parseIssueId(string $filename): ?string { - return GeneralUtility::trimExplode('-', $filename)[1]; + return GeneralUtility::trimExplode('-', $filename)[1] ?? null; } /** diff --git a/typo3/sysext/install/Resources/Private/Partials/Upgrade/UpgradeDocs/PanelItem.html b/typo3/sysext/install/Resources/Private/Partials/Upgrade/UpgradeDocs/PanelItem.html index 059aa88fca96..5bfce94dc6e6 100644 --- a/typo3/sysext/install/Resources/Private/Partials/Upgrade/UpgradeDocs/PanelItem.html +++ b/typo3/sysext/install/Resources/Private/Partials/Upgrade/UpgradeDocs/PanelItem.html @@ -29,7 +29,9 @@ <div id="collapse{id}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{id}"> <div class="rst-tags t3js-tags"></div> <div class="rst-links"> - <a href="{fileArray.url.issue}" target="_blank" rel="noreferrer" class="nowrap"><core:icon identifier="actions-window-open" /> Open issue</a> + <f:if condition="{fileArray.url.issue}"> + <a href="{fileArray.url.issue}" target="_blank" rel="noreferrer" class="nowrap"><core:icon identifier="actions-window-open" /> Open issue</a> + </f:if> <f:if condition="{fileArray.url.documentation}"> <a href="{fileArray.url.documentation}" target="_blank" rel="noreferrer" class="nowrap"><core:icon identifier="actions-window-open" /> Open rendered version</a> </f:if> -- GitLab