Page MenuHomePhabricator

Incorrect summary when summary includes "$100" (somebody forgot to escape their regular expression replacement)
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

api = new mw.Api;
api.postWithEditToken({'action':'move','format':'json','noredirect':true,'from':'File:Test upload header 3 $100 bill6.svg','to':'File:Test upload header 3 $100 bill7.svg','reason':'test money move','movetalk':1});

Or use Special:MovePage.

What happens?:
API move:
"AJ moved page File:Test upload header 3 0 bill6.svg to File:Test upload header 3 0 bill7.svg without leaving a redirect: test money move"
The move was executed correctly though.
After moving the file once more (using Special:MovePage this time), the edit summary for that very same move from 21:50 has changed(!):
"AJ moved page File:Test upload header 3 0 bill6.svg to File:Test upload header 3 $100 bill7.svg without leaving a redirect: test money move"

Special:MovePage:
"AJ moved page File:Test upload header 3 0 bill7.svg to File:Test upload header 3 0 bill8.svg without leaving a redirect: money move test using special:movepage (previous move was with API)"
The "to" links are dead in both cases.

What should have happened instead?:
$100 shouldn't turn into 0.

Update: I guess non-moves can also be affected:

action	edit
format	json
minor	1
nocreate	true
title	Mexican+peso
summary	Renamed+[[:File:Banco+de+México+C+$100+reverse+(ESTADOS).png|file]]+to+[[:File:Banco+de+México+C+$100+reverse+(CULTURA).png]]:+[[WP:FNC#1|Uploader+requested]],+Typo+introduced+during+initial+upload+([[User:Alexis+Jazz/LuckyRename|LuckyRename]])
text	(all the page text)
watchlist	nochange
token	yes there was one

Renamed file to File:Banco de México C 0 reverse (CULTURA).png: Uploader requested, Typo introduced during initial upload (LuckyRename)
The "file" link points to https://en.wikipedia.org/wiki/File:Banco_de_M%C3%A9xico_C_0_reverse_(ESTADOS).png. I think that one changed as well when the page was edited shortly after by another editor.

Event Timeline

AlexisJazz renamed this task from Incorrect summary when moving file with "$100" in the title (somebody forgot to escape their regular expression replacement) to Incorrect summary when summary includes "$100" (somebody forgot to escape their regular expression replacement).Apr 28 2022, 10:44 PM
AlexisJazz updated the task description. (Show Details)

This is really strange:
https://commons.wikimedia.beta.wmflabs.org/w/index.php?title=File:Test_upload_header_3_$100_bill8.svg&diff=278109&oldid=278106
Summary for move from 21:50:
AJ moved page File:Test upload header 3 0 bill6.svg to File:Test upload header 3 $100 bill7.svg without leaving a redirect: test money move

https://commons.wikimedia.beta.wmflabs.org/w/index.php?title=File:Test_upload_header_3_$100_bill8.svg&diff=278111&oldid=278109
Summary for move from 21:50, same move but displayed in another column:
AJ moved page File:Test upload header 3 $100 bill6.svg to File:Test upload header 3 $100 bill7.svg without leaving a redirect: test money move

Also note how this bug results in blue links to non-existing files. Not red.

Change 829075 had a related patch set uploaded (by WelpThatWorked; author: WelpThatWorked):

[mediawiki/core@master] Escape link markers before replacement when building comments.

https://gerrit.wikimedia.org/r/829075

Change 829075 merged by jenkins-bot:

[mediawiki/core@master] Escape link markers before replacement when building comments.

https://gerrit.wikimedia.org/r/829075