Skip to content

Commit 720fc91

Browse files
committed
Make written byte counter variable name more obvious
Signed-off-by: Julius Härtl <[email protected]>
1 parent 259f8c4 commit 720fc91

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ public function put($data) {
202202
});
203203

204204
$result = true;
205-
$count = -1;
205+
$writtenByteCount = -1;
206206
try {
207-
$count = $partStorage->writeStream($internalPartPath, $wrappedData);
207+
$writtenByteCount = $partStorage->writeStream($internalPartPath, $wrappedData);
208208
} catch (GenericFileException $e) {
209209
$result = false;
210210
}
@@ -223,7 +223,7 @@ public function put($data) {
223223
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
224224
throw new Exception('Could not write file contents');
225225
}
226-
[$count, $result] = \OC_Helper::streamCopy($data, $target);
226+
[$writtenByteCount, $result] = \OC_Helper::streamCopy($data, $target);
227227
fclose($target);
228228
}
229229

@@ -233,7 +233,7 @@ public function put($data) {
233233
$expected = $_SERVER['CONTENT_LENGTH'];
234234
}
235235
if ($expected !== "0") {
236-
throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
236+
throw new Exception('Error while copying file to target location (copied bytes: ' . $writtenByteCount . ', expected filesize: ' . $expected . ' )');
237237
}
238238
}
239239

@@ -242,8 +242,8 @@ public function put($data) {
242242
// compare expected and actual size
243243
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
244244
$expected = (int)$_SERVER['CONTENT_LENGTH'];
245-
if ($count !== $expected) {
246-
throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
245+
if ($writtenByteCount !== $expected) {
246+
throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $writtenByteCount . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.');
247247
}
248248
}
249249
} catch (\Exception $e) {
@@ -307,7 +307,7 @@ public function put($data) {
307307
}
308308

309309
// since we skipped the view we need to scan and emit the hooks ourselves
310-
$storage->getUpdater()->update($internalPath, null, ($count-$previousFileSize));
310+
$storage->getUpdater()->update($internalPath, null, ($writtenByteCount - $previousFileSize));
311311

312312
try {
313313
$this->changeLock(ILockingProvider::LOCK_SHARED);

0 commit comments

Comments
 (0)