Improve how slashes are stripped from filenames
authorBartosz Dziewoński <matma.rex@gmail.com>
Sun, 24 Jul 2016 19:44:35 +0000 (21:44 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sun, 24 Jul 2016 22:24:36 +0000 (00:24 +0200)
commitea43031b39e9951c8cb9a32abc9610f77618d83a
treeb96c15bdc978b02a0b7db43a84acd9befb65db1c
parent5998bb22e39f9a6b3e9184429920e9c7b5408c00
Improve how slashes are stripped from filenames

* Add slash and backslash ('/' and '\') to $wgIllegalFileChars.
* Replace illegal chars before removing paths in wfStripIllegalFilenameChars().

This way users trying to upload a file with slashes in the name will
get a better filename suggestion (e.g. for 'Foo part 1/3.jpg', you
previously got '3.jpg', now you'll get 'Foo part 1-3.jpg'). Uploading
tools that don't special-case slashes will also behave better.

Change-Id: Ib78f48a5f8c92e8ab2dc773ea6789b96b3662177
includes/DefaultSettings.php
includes/GlobalFunctions.php
tests/phpunit/includes/upload/UploadBaseTest.php