Strip all wikilinks for initial edit summary

The regex that removes the wikilinks to create the initial edit summary
should have the global flag since it was taken from preg_replace which
replaces globally implicitly.

Bug: T276722
Change-Id: I21e3cdfe752657ad37d9a6bd473a7e7dbb6e4cd6
This commit is contained in:
BrandonXLF 2021-03-07 16:03:11 -05:00
parent 013d5068c2
commit 73adc9ac78

View file

@ -1917,9 +1917,9 @@ ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
// Extract the title
.replace( /^\s*=+\s*(.*?)\s*=+\s*$/, '$1' )
// Remove links
.replace( /\[\[:?([^[|]+)\|([^[]+)\]\]/, '$2' )
.replace( /\[\[:?([^[]+)\|?\]\]/, '$1' )
.replace( new RegExp( '\\[(?:' + ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + ')([^ ]+?) ([^\\[]+)\\]', 'i' ), '$3' )
.replace( /\[\[:?([^[|]+)\|([^[]+)\]\]/g, '$2' )
.replace( /\[\[:?([^[]+)\|?\]\]/g, '$1' )
.replace( new RegExp( '\\[(?:' + ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + ')([^ ]+?) ([^\\[]+)\\]', 'ig' ), '$3' )
// Cheap HTML removal
.replace( /<[^>]+?>/g, '' );
}