Page MenuHomePhabricator

Special:PageMigration inserts comma instead of new line
Closed, ResolvedPublic


Special:PageMigration may import

== header ==,{{template}}

instead of

== header ==

Note the first new line character has been replaced with a comma. I am not sure about the minimal test case, but this seems related to headings (this seems to doesn’t happen when heading is followed by two successive new lines).

You can try on Meta with Complete list of Wikimedia projects/sv page.

I am pretty sure this is a recent regression.

Event Timeline

Problem is in splitHeaders (rETRA resources/js/ext.translate.special.pagemigration.js:256), introduced in The callback function replaces the array element (a string) with an array of two strings. would automatically flatten the array of arrays that was created into a single array of strings, but does not. When the HTML was output, the array of two strings was silently converted to string form. Simply swapping it out for Array.prototype.flatMap() fixes this issue.

Not actually related to T285968, they just happened to look similar (unexplained merging) and occurred together (around headings) often.

Change 718937 had a related patch set uploaded (by AntiCompositeNumber; author: AntiCompositeNumber):

[mediawiki/extensions/Translate@master] ext.translate.special.pagemigration: Replace with Array.flatMap()

Change 718937 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ext.translate.special.pagemigration: Flatten