From 9853803750059518cb51c035ab9fedc67fe0aedc Mon Sep 17 00:00:00 2001 From: rillke Date: Thu, 12 Feb 2015 16:59:09 +0100 Subject: [PATCH] Chunked upload: Return expected offset on offset error Bug: T87535 Change-Id: If68e0075e73a78c1dd8d95839f7ee9374a995201 --- includes/api/ApiUpload.php | 6 +++++- includes/upload/UploadFromChunks.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 62d8882898..78a497144f 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -218,7 +218,11 @@ class ApiUpload extends ApiBase { $status = $this->mUpload->addChunk( $chunkPath, $chunkSize, $this->mParams['offset'] ); if ( !$status->isGood() ) { - $this->dieUsage( $status->getWikiText(), 'stashfailed' ); + $extradata = array( + 'offset' => $this->mUpload->getOffset(), + ); + + $this->dieUsage( $status->getWikiText(), 'stashfailed', 0, $extradata ); return array(); } diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 8e6c9c6061..3c249ce9ee 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -303,10 +303,10 @@ class UploadFromChunks extends UploadFromFile { } /** - * Gets the current offset in fromt the stashedupload table + * Get the offset at which the next uploaded chunk will be appended to * @return int Current byte offset of the chunk file set */ - private function getOffset() { + public function getOffset() { if ( $this->mOffset !== null ) { return $this->mOffset; } -- 2.20.1