jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/331985 )
Change subject: Fix length calculation for shortening transcode filenames
......................................................................
Fix length calculation for shortening transcode filenames
Follow-up to I826af75e to include the hash, which wasn't being
counted causing some files to be miscounted as not requiring
shortage. Also made the counting clearer on what it was doing
instead of having a random ' + 12' at the end. ;)
Should fix long Russian filenames that were _just_ the wrong
length to get stored.
Bug: T155248
Change-Id: I2a3765bd594f5c12b838f9c2d7593596c1dd3936
---
M WebVideoTranscode/WebVideoTranscode.php
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Paladox: Looks good to me, but someone else must approve
jenkins-bot: Verified
TheDJ: Looks good to me, approved
diff --git a/WebVideoTranscode/WebVideoTranscode.php
b/WebVideoTranscode/WebVideoTranscode.php
index 0ada0c4..eaccdb9 100644
--- a/WebVideoTranscode/WebVideoTranscode.php
+++ b/WebVideoTranscode/WebVideoTranscode.php
@@ -538,8 +538,8 @@
* Get the name to use as the base name for the transcode.
*
* Swift has problems where the url-encoded version of
- * the path (ie 'filename.ogv/filename.ogv.720p.webm' )
- * is greater that > 1024 bytes, so shorten in that case.
+ * the path (ie '0/00/filename.ogv/filename.ogv.720p.webm' )
+ * is greater than > 1024 bytes, so shorten in that case.
*
* Future versions might respect FileRepo::$abbrvThreshold.
*
@@ -549,7 +549,8 @@
*/
public static function getTranscodeFileBaseName( $file, $suffix = '' ) {
$name = $file->getName();
- if ( strlen( urlencode( $name ) ) * 2 + 12 > 1024 ) {
+ $length = strlen( urlencode( '0/00/' . $name . '/' . $name .
'.' . $suffix ) );
+ if ( $length > 1024 ) {
return 'transcode' . '.' . $suffix;
} else {
return $name . '.' . $suffix;
--
To view, visit https://gerrit.wikimedia.org/r/331985
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2a3765bd594f5c12b838f9c2d7593596c1dd3936
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits