devunt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/192773
Change subject: Trim spaces and underscores from suggested filename on
Special:Upload
......................................................................
Trim spaces and underscores from suggested filename on Special:Upload
Doesn't enforce it, but client-side we remove them from the initial
value for wpDestFile. Follows I8a8e6f841b65b128bb05b625f5cacd62102fc319
Bug: T67811
Change-Id: Ic9c70536bc23bcabeeba20c6bf4150715e051f89
---
M resources/src/mediawiki.special/mediawiki.special.upload.js
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/73/192773/1
diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js
b/resources/src/mediawiki.special/mediawiki.special.upload.js
index 2f03c51..565d360 100644
--- a/resources/src/mediawiki.special/mediawiki.special.upload.js
+++ b/resources/src/mediawiki.special/mediawiki.special.upload.js
@@ -231,6 +231,16 @@
// Replace spaces by underscores
fname = fname.replace( / /g, '_' );
+
+ // Remove trailing spaces (T67811)
+ if ( fname.lastIndexOf( '.' ) !== -1 ) {
+ ext = fname.substr( fname.lastIndexOf(
'.' ) );
+ fname = fname.substr( 0,
fname.lastIndexOf( '.' ) );
+ fname = fname.replace( /_+$/, '' ) +
ext;
+ } else {
+ fname = fname.replace( /_+$/, '' );
+ }
+
// Capitalise first letter if needed
if ( mw.config.get( 'wgCapitalizeUploads' ) ) {
fname = fname.charAt( 0
).toUpperCase().concat( fname.slice( 1 ) );
--
To view, visit https://gerrit.wikimedia.org/r/192773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9c70536bc23bcabeeba20c6bf4150715e051f89
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: devunt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits