jenkins-bot has submitted this change and it was merged.
Change subject: Don't allow consecutive apostrophes
......................................................................
Don't allow consecutive apostrophes
Turn them into '_
Change-Id: Id5625e262dc7e97fe8c5debe1401f1a509132034
---
M javascripts/common/uploads/PhotoApi.js
M tests/javascripts/common/uploads/test_PhotoApi.js
2 files changed, 9 insertions(+), 0 deletions(-)
Approvals:
JGonera: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/common/uploads/PhotoApi.js
b/javascripts/common/uploads/PhotoApi.js
index cf511a1..80b4085 100644
--- a/javascripts/common/uploads/PhotoApi.js
+++ b/javascripts/common/uploads/PhotoApi.js
@@ -62,6 +62,8 @@
fileSuffix = fileSuffix || '.jpg';
date = date || new Date();
name = description.replace(
/[\x1B\n\x7f\.\[#<>\[\]\|\{\}\/:]/g, '-' );
+ //
http://commons.wikimedia.org/wiki/MediaWiki:Titleblacklist-custom-double-apostrophe
+ name = name.replace( /''/g, '\'_' );
function pad( number ) {
return number < 10 ? '0' + number : number;
diff --git a/tests/javascripts/common/uploads/test_PhotoApi.js
b/tests/javascripts/common/uploads/test_PhotoApi.js
index e4db2a6..84a8c59 100644
--- a/tests/javascripts/common/uploads/test_PhotoApi.js
+++ b/tests/javascripts/common/uploads/test_PhotoApi.js
@@ -85,6 +85,13 @@
'Check file name is description with appended date' );
} );
+ QUnit.test( 'generateFileName with double apostrophes', 1, function() {
+ var date = new Date( 2010, 9, 15, 12, 9 ),
+ name = photo.generateFileName( "Image of '' the double
apostrophe", '.jpg', date );
+ strictEqual( name, 'Image of \'_ the double apostrophe
2010-10-15 12-09.jpg',
+ 'Check double apostrophe stripped out' );
+ } );
+
QUnit.test( 'generateFileName test padding', 1, function() {
var date = new Date( 2013, 2, 1, 12, 51 ), // note 0 = january
name = photo.generateFileName( 'Tomasz eating bacon
next to a dinosaur', '.jpg', date );
--
To view, visit https://gerrit.wikimedia.org/r/70222
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5625e262dc7e97fe8c5debe1401f1a509132034
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits