[BUGFIX] EM must treat line breaks correctly in extension data 16/50516/5
authorMarkus Klein <markus.klein@typo3.org>
Mon, 7 Nov 2016 00:38:47 +0000 (01:38 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 13 Nov 2016 09:33:40 +0000 (10:33 +0100)
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>
typo3/sysext/extensionmanager/Classes/Utility/Parser/AbstractExtensionXmlParser.php
typo3/sysext/extensionmanager/Classes/Utility/Parser/ExtensionXmlPushParser.php
typo3/sysext/extensionmanager/Resources/Private/Partials/List/TerShowVersionsSingleLine.html
typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js

index 3c45026..85960ad 100644 (file)
@@ -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;
         }
     }
 
index c8ceccf..b906939 100644 (file)
@@ -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);
index 24b61cb..da26943 100644 (file)
@@ -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>
index 173ab3d..bb5d58f 100644 (file)
@@ -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">
index 75cbd7f..584a782 100644 (file)
@@ -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++;
                });