MediaWiki talk:Gadget-modrollback.js

From mediawiki.org
Latest comment: 13 years ago by Krinkle

This gadget appears to be currently broken for usernames containing spaces, which are interpreted as plus signs instead of underscores; see w:en:Wikipedia:Village_pump_(technical)#Post-rollback_redirect_broken. I think this can be fixed by inserting <syntaxhighlight lang="javascript">user = user.replace("+", "_");</v> after line 9, but perhaps there is a better method. Ucucha 21:48, 20 February 2011 (UTC)Reply

This is a bug in the software, not in JavaScript. It uses urlencode instead of (wiki|raw)urlencode when adding the user name in the from parameter, causing the space to become a plus sign. I've reported this under bug 27606 and added the temporary fix (using regex and /g though, since there could be multiple +/spaces) Krinkle 11:32, 21 February 2011 (UTC)Reply
Shouldn't it be
user = user.replace(/\+/g, '_');
? Helder 21:37, 21 February 2011 (UTC)
There's no need to assign the variable twice, I accidently put a line-break there. Fixed now:
user = mw.util.getParamValue('from', ...).replace( ... );
Krinkle 07:46, 22 February 2011 (UTC)Reply