http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88244
Revision: 88244
Author: j
Date: 2011-05-16 15:40:27 +0000 (Mon, 16 May 2011)
Log Message:
-----------
check that chunk offset matches file size before appending to file
Modified Paths:
--------------
trunk/extensions/ResumableUpload/ResumableUploadHandler.php
Modified: trunk/extensions/ResumableUpload/ResumableUploadHandler.php
===================================================================
--- trunk/extensions/ResumableUpload/ResumableUploadHandler.php 2011-05-16
15:27:42 UTC (rev 88243)
+++ trunk/extensions/ResumableUpload/ResumableUploadHandler.php 2011-05-16
15:40:27 UTC (rev 88244)
@@ -66,9 +66,10 @@
*
* @return mixed True if there was no error, otherwise an error
description suitable for passing to dieUsage()
*/
- public function initialize( $done, $filename, $sessionKey, $path,
$chunkSize, $sessionData ) {
+ public function initialize( $done, $chunkOffset, $filename,
$sessionKey, $path, $chunkSize, $sessionData ) {
if( $filename ) $this->mDesiredDestName = $filename;
$this->mTempPath = $path;
+ $this->mChunkOffset = $chunkOffset;
if ( $sessionKey !== null ) {
$status = $this->initFromSessionKey( $sessionKey,
$sessionData, $chunkSize );
@@ -144,11 +145,14 @@
}
if ( $this->getRealPath( $this->repoPath ) ) {
- $this->status = $this->appendToUploadFile(
$this->repoPath, $this->mTempPath );
+ if ( $this->getSize( $this->repoPath ) ==
$this->mChunkOffset ) {
+ $this->status = $this->appendToUploadFile(
$this->repoPath, $this->mTempPath );
+ if ( $this->mFileSize > $wgMaxUploadSize )
+ $this->status = Status::newFatal(
'largefileserver' );
+ } else {
+ $this->status = Status::newFatal( 'failed, chunk
offset does not match file' );
+ }
- if ( $this->mFileSize > $wgMaxUploadSize )
- $this->status = Status::newFatal(
'largefileserver' );
-
} else {
$this->status = Status::newFatal( 'filenotfound',
$this->repoPath );
}
@@ -163,4 +167,4 @@
$this->appendChunk();
$this->mTempPath = $this->getRealPath( $this->repoPath );
}
-}
\ No newline at end of file
+}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs