User "Krinkle" posted a comment on MediaWiki.r87808.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87808#c18300
Commit summary:

Prevent user from trying to move a page to a title longer than 255 bytes.

This just puts a maxlength on the field (+ byte counter js) which is much
nicer and clearer feedback to the user if they went over the limit then:
"The requested page title was invalid, empty, or an incorrectly linked 
inter-language or inter-wiki title. It may contain one or more characters which 
cannot be used in titles"
Which doesn't exactly indicate a length error.

Comment:

The pagename length is not a static number (ie. not 255, per Platonides), but 
the "title" (as in page_title) length is set to 255.

So what we want is to get only the title portion. Although extracting the title 
part from a string is complex to do ad-hoc (localization, aliases, canonical 
namespaces, lower/uppercase, trimming of whitespace), it's rather easy with 
mw.Title:

var title = new mw.Title( inputValue );
text.getMain(); // returns db-like version of the title, without namespace, ie. 
Foo_bar.jpg)

Although in order to be able to actually filter the inputValue, byteLimit needs 
the ability to pass a callback/filter function.

It's a little overhead to do now, but I think in a few days/weeks when the 
convenience dependancies are solved, this would be easy. 


Recorded in BugZilla:
* ([[bugzilla:29454|bug 29454]]) Enforce byteLimit on wpNewTitle on Special:Move

_______________________________________________
MediaWiki-CodeReview mailing list
mediawiki-coderev...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to