From 3ee07f8baa30cae498d525889d2d84cfaab6f36c Mon Sep 17 00:00:00 2001 From: Markus Klein <markus.klein@typo3.org> Date: Mon, 7 Nov 2016 01:38:47 +0100 Subject: [PATCH] [BUGFIX] EM must treat line breaks correctly in extension data The XML push-parser now correctly collects the data for description and upload comment. When the data contain line breaks the characterData() method is called multiple times for each line of data. Resolves: #78306 Releases: master, 7.6 Change-Id: Ibfa446b92904572d1f4530b265e94228857a5f02 Reviewed-on: https://review.typo3.org/50516 Reviewed-by: Nicole Cordes <typo3@cordes.co> Tested-by: Nicole Cordes <typo3@cordes.co> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> --- .../Classes/Utility/Parser/AbstractExtensionXmlParser.php | 4 ++-- .../Classes/Utility/Parser/ExtensionXmlPushParser.php | 4 ++-- .../Private/Partials/List/TerShowVersionsSingleLine.html | 4 ++-- .../Resources/Private/Templates/List/ShowAllVersions.html | 2 +- .../extensionmanager/Resources/Public/JavaScript/Main.js | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php b/typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php index 3c45026d8030..85960adb98cf 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php @@ -389,9 +389,9 @@ abstract class AbstractExtensionXmlParser extends AbstractXmlParser // resetting at least class property "version" is mandatory // as we need to do some magic in regards to // an extension's and version's child node "downloadcounter" - $this->version = ($this->title = ($this->versionDownloadCounter = ($this->description = ($this->state = ($this->reviewstate = ($this->category = ($this->lastuploaddate = ($this->uploadcomment = ($this->dependencies = ($this->authorname = ($this->authoremail = ($this->authorcompany = ($this->ownerusername = ($this->t3xfilemd5 = null)))))))))))))); + $this->version = $this->title = $this->versionDownloadCounter = $this->description = $this->state = $this->reviewstate = $this->category = $this->lastuploaddate = $this->uploadcomment = $this->dependencies = $this->authorname = $this->authoremail = $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = null; if ($resetAll) { - $this->extensionKey = ($this->extensionDownloadCounter = null); + $this->extensionKey = $this->extensionDownloadCounter = null; } } diff --git a/typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php b/typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php index c8ceccf492fc..b9069398de82 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php @@ -153,7 +153,7 @@ class ExtensionXmlPushParser extends AbstractExtensionXmlParser $this->title = $data; break; case 'description': - $this->description = $data; + $this->description .= $data; break; case 'state': $this->state = $data; @@ -168,7 +168,7 @@ class ExtensionXmlPushParser extends AbstractExtensionXmlParser $this->lastuploaddate = $data; break; case 'uploadcomment': - $this->uploadcomment = $data; + $this->uploadcomment .= $data; break; case 'dependencies': $this->dependencies = $this->convertDependencies($data); diff --git a/typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerShowVersionsSingleLine.html b/typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerShowVersionsSingleLine.html index 24b61cb6f0a7..da269437a016 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerShowVersionsSingleLine.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerShowVersionsSingleLine.html @@ -9,11 +9,11 @@ {extension.version} </td> <td> - {extension.updateComment} + <f:format.nl2br>{extension.updateComment}</f:format.nl2br> </td> <td> <f:format.date>{extension.lastUpdated}</f:format.date> </td> <td class="{extension.stateString}"> {extension.stateString} -</td> \ No newline at end of file +</td> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html index 173ab3d4cdd8..bb5d58fe7acc 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html @@ -15,7 +15,7 @@ <f:section name="content"> <f:if condition="{currentVersion}"> - <p>{currentVersion.description}</p> + <p><f:format.nl2br>{currentVersion.description}</f:format.nl2br></p> <table cellpadding="0" cellspacing="0" class="currentVersionInfo"> <tr class="ter-ext-single-info-key"> diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js index 75cbd7fe4f58..584a78272e58 100644 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js @@ -247,7 +247,8 @@ define([ message += '<form>'; var i = 0; $.each(data.updateComments, function(version, comment) { - message += '<h3><input type="radio" ' + (i == 0 ? 'checked="checked" ' : '') + 'name="version" value="' + version + '" /> ' + version + '</h3>'; + comment = comment.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2'); + message += '<h3><input type="radio" ' + (i === 0 ? 'checked="checked" ' : '') + 'name="version" value="' + version + '" /> ' + version + '</h3>'; message += '<div>' + comment + '</div>'; i++; }); -- GitLab