Index: trunk/extensions/ResumableUpload/ResumableUploadHandler.php |
— | — | @@ -66,9 +66,10 @@ |
67 | 67 | * |
68 | 68 | * @return mixed True if there was no error, otherwise an error description suitable for passing to dieUsage() |
69 | 69 | */ |
70 | | - public function initialize( $done, $filename, $sessionKey, $path, $chunkSize, $sessionData ) { |
| 70 | + public function initialize( $done, $chunkOffset, $filename, $sessionKey, $path, $chunkSize, $sessionData ) { |
71 | 71 | if( $filename ) $this->mDesiredDestName = $filename; |
72 | 72 | $this->mTempPath = $path; |
| 73 | + $this->mChunkOffset = $chunkOffset; |
73 | 74 | |
74 | 75 | if ( $sessionKey !== null ) { |
75 | 76 | $status = $this->initFromSessionKey( $sessionKey, $sessionData, $chunkSize ); |
— | — | @@ -144,11 +145,14 @@ |
145 | 146 | } |
146 | 147 | |
147 | 148 | if ( $this->getRealPath( $this->repoPath ) ) { |
148 | | - $this->status = $this->appendToUploadFile( $this->repoPath, $this->mTempPath ); |
| 149 | + if ( $this->getSize( $this->repoPath ) == $this->mChunkOffset ) { |
| 150 | + $this->status = $this->appendToUploadFile( $this->repoPath, $this->mTempPath ); |
| 151 | + if ( $this->mFileSize > $wgMaxUploadSize ) |
| 152 | + $this->status = Status::newFatal( 'largefileserver' ); |
| 153 | + } else { |
| 154 | + $this->status = Status::newFatal( 'failed, chunk offset does not match file' ); |
| 155 | + } |
149 | 156 | |
150 | | - if ( $this->mFileSize > $wgMaxUploadSize ) |
151 | | - $this->status = Status::newFatal( 'largefileserver' ); |
152 | | - |
153 | 157 | } else { |
154 | 158 | $this->status = Status::newFatal( 'filenotfound', $this->repoPath ); |
155 | 159 | } |
— | — | @@ -163,4 +167,4 @@ |
164 | 168 | $this->appendChunk(); |
165 | 169 | $this->mTempPath = $this->getRealPath( $this->repoPath ); |
166 | 170 | } |
167 | | -} |
\ No newline at end of file |
| 171 | +} |