jenkins-bot has submitted this change and it was merged.
Change subject: Bug 49544: Allow margin of error in filename generation
......................................................................
Bug 49544: Allow margin of error in filename generation
In exploring these seems like it could be the main cause
of bug 49544
Bug: 49544
Change-Id: Ib1a9fe3bf9db732f00268a2f84733755f4bf1f76
---
M javascripts/common/uploads/PhotoApi.js
M tests/javascripts/common/uploads/test_PhotoApi.js
2 files changed, 4 insertions(+), 3 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 80b4085..3fe0dcc 100644
--- a/javascripts/common/uploads/PhotoApi.js
+++ b/javascripts/common/uploads/PhotoApi.js
@@ -56,7 +56,8 @@
* @return {String} a legal filename
*/
function generateFileName( description, fileSuffix, date ) {
- var allowedLength = 240, // 240 bytes maximum enforced by
MediaWiki
+ // 240 bytes maximum enforced by MediaWiki - allow 10bytes
margin of error
+ var allowedLength = 230,
name, suffix;
fileSuffix = fileSuffix || '.jpg';
diff --git a/tests/javascripts/common/uploads/test_PhotoApi.js
b/tests/javascripts/common/uploads/test_PhotoApi.js
index 84a8c59..ba41df2 100644
--- a/tests/javascripts/common/uploads/test_PhotoApi.js
+++ b/tests/javascripts/common/uploads/test_PhotoApi.js
@@ -108,8 +108,8 @@
longDescription += 'a';
}
name = photo.generateFileName( longDescription, '.jpg', date );
- strictEqual( name.length, 240, 'Check file name was shortened
to the minimum length' );
- strictEqual( name.substr( 233, 7 ), '-51.jpg', 'ends with date'
);
+ strictEqual( name.length, 230, 'Check file name was shortened
to the minimum length' );
+ strictEqual( name.substr( 223, 7 ), '-51.jpg', 'ends with date'
);
} );
QUnit.test( 'generateFileName with new lines', 1, function() {
--
To view, visit https://gerrit.wikimedia.org/r/70223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1a9fe3bf9db732f00268a2f84733755f4bf1f76
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