|
@@ -126,7 +126,7 @@ discard block |
|
|
block discarded – undo |
|
126
|
126
|
throw new Forbidden(); |
|
127
|
127
|
} |
|
128
|
128
|
} catch (StorageNotAvailableException $e) { |
|
129
|
|
- throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
|
129
|
+ throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
130
|
130
|
} |
|
131
|
131
|
|
|
132
|
132
|
// verify path of the target |
|
@@ -149,7 +149,7 @@ discard block |
|
|
block discarded – undo |
|
149
|
149
|
|
|
150
|
150
|
if ($needsPartFile) { |
|
151
|
151
|
// mark file as partial while uploading (ignored by the scanner) |
|
152
|
|
- $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
|
152
|
+ $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
153
|
153
|
|
|
154
|
154
|
if (!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) { |
|
155
|
155
|
$needsPartFile = false; |
|
@@ -183,19 +183,19 @@ discard block |
|
|
block discarded – undo |
|
183
|
183
|
$data = $tmpData; |
|
184
|
184
|
} |
|
185
|
185
|
|
|
186
|
|
- $data = HashWrapper::wrap($data, 'md5', function ($hash) { |
|
187
|
|
- $this->header('X-Hash-MD5: ' . $hash); |
|
|
186
|
+ $data = HashWrapper::wrap($data, 'md5', function($hash) { |
|
|
187
|
+ $this->header('X-Hash-MD5: '.$hash); |
|
188
|
188
|
}); |
|
189
|
|
- $data = HashWrapper::wrap($data, 'sha1', function ($hash) { |
|
190
|
|
- $this->header('X-Hash-SHA1: ' . $hash); |
|
|
189
|
+ $data = HashWrapper::wrap($data, 'sha1', function($hash) { |
|
|
190
|
+ $this->header('X-Hash-SHA1: '.$hash); |
|
191
|
191
|
}); |
|
192
|
|
- $data = HashWrapper::wrap($data, 'sha256', function ($hash) { |
|
193
|
|
- $this->header('X-Hash-SHA256: ' . $hash); |
|
|
192
|
+ $data = HashWrapper::wrap($data, 'sha256', function($hash) { |
|
|
193
|
+ $this->header('X-Hash-SHA256: '.$hash); |
|
194
|
194
|
}); |
|
195
|
195
|
|
|
196
|
196
|
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) { |
|
197
|
197
|
$isEOF = false; |
|
198
|
|
- $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF) { |
|
|
198
|
+ $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) { |
|
199
|
199
|
$isEOF = feof($stream); |
|
200
|
200
|
}); |
|
201
|
201
|
|
|
@@ -225,7 +225,7 @@ discard block |
|
|
block discarded – undo |
|
225
|
225
|
$expected = $_SERVER['CONTENT_LENGTH']; |
|
226
|
226
|
} |
|
227
|
227
|
if ($expected !== "0") { |
|
228
|
|
- throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
|
228
|
+ throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
229
|
229
|
} |
|
230
|
230
|
} |
|
231
|
231
|
|
|
@@ -233,9 +233,9 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
// double check if the file was fully received |
|
234
|
234
|
// compare expected and actual size |
|
235
|
235
|
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
|
236
|
|
- $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
|
236
|
+ $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
237
|
237
|
if ($count !== $expected) { |
|
238
|
|
- 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.'); |
|
|
238
|
+ 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.'); |
|
239
|
239
|
} |
|
240
|
240
|
} |
|
241
|
241
|
} catch (\Exception $e) { |
|
@@ -284,7 +284,7 @@ discard block |
|
|
block discarded – undo |
|
284
|
284
|
$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); |
|
285
|
285
|
$fileExists = $storage->file_exists($internalPath); |
|
286
|
286
|
if ($renameOkay === false || $fileExists === false) { |
|
287
|
|
- \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']); |
|
|
287
|
+ \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']); |
|
288
|
288
|
throw new Exception('Could not rename part file to final file'); |
|
289
|
289
|
} |
|
290
|
290
|
} catch (ForbiddenException $ex) { |
|
@@ -340,10 +340,10 @@ discard block |
|
|
block discarded – undo |
|
340
|
340
|
$this->refreshInfo(); |
|
341
|
341
|
} |
|
342
|
342
|
} catch (StorageNotAvailableException $e) { |
|
343
|
|
- throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e); |
|
|
343
|
+ throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage(), 0, $e); |
|
344
|
344
|
} |
|
345
|
345
|
|
|
346
|
|
- return '"' . $this->info->getEtag() . '"'; |
|
|
346
|
+ return '"'.$this->info->getEtag().'"'; |
|
347
|
347
|
} |
|
348
|
348
|
|
|
349
|
349
|
private function getPartFileBasePath($path) { |
|
@@ -430,9 +430,9 @@ discard block |
|
|
block discarded – undo |
|
430
|
430
|
return $res; |
|
431
|
431
|
} catch (GenericEncryptionException $e) { |
|
432
|
432
|
// returning 503 will allow retry of the operation at a later point in time |
|
433
|
|
- throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
|
433
|
+ throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
434
|
434
|
} catch (StorageNotAvailableException $e) { |
|
435
|
|
- throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
|
435
|
+ throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
436
|
436
|
} catch (ForbiddenException $ex) { |
|
437
|
437
|
throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
|
438
|
438
|
} catch (LockedException $e) { |
|
@@ -457,7 +457,7 @@ discard block |
|
|
block discarded – undo |
|
457
|
457
|
throw new Forbidden(); |
|
458
|
458
|
} |
|
459
|
459
|
} catch (StorageNotAvailableException $e) { |
|
460
|
|
- throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
|
460
|
+ throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
461
|
461
|
} catch (ForbiddenException $ex) { |
|
462
|
462
|
throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
|
463
|
463
|
} catch (LockedException $e) { |
|
@@ -520,10 +520,10 @@ discard block |
|
|
block discarded – undo |
|
520
|
520
|
//detect aborted upload |
|
521
|
521
|
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
|
522
|
522
|
if (isset($_SERVER['CONTENT_LENGTH'])) { |
|
523
|
|
- $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
|
523
|
+ $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
524
|
524
|
if ($bytesWritten !== $expected) { |
|
525
|
525
|
$chunk_handler->remove($info['index']); |
|
526
|
|
- throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $bytesWritten . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
|
526
|
+ throw new BadRequest('Expected filesize of '.$expected.' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) '.$bytesWritten.' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); |
|
527
|
527
|
} |
|
528
|
528
|
} |
|
529
|
529
|
} |
|
@@ -534,7 +534,7 @@ discard block |
|
|
block discarded – undo |
|
534
|
534
|
$needsPartFile = $storage->needsPartFile(); |
|
535
|
535
|
$partFile = null; |
|
536
|
536
|
|
|
537
|
|
- $targetPath = $path . '/' . $info['name']; |
|
|
537
|
+ $targetPath = $path.'/'.$info['name']; |
|
538
|
538
|
/** @var \OC\Files\Storage\Storage $targetStorage */ |
|
539
|
539
|
list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
|
540
|
540
|
|
|
@@ -550,7 +550,7 @@ discard block |
|
|
block discarded – undo |
|
550
|
550
|
|
|
551
|
551
|
if ($needsPartFile) { |
|
552
|
552
|
// we first assembly the target file as a part file |
|
553
|
|
- $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
|
553
|
+ $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
554
|
554
|
/** @var \OC\Files\Storage\Storage $targetStorage */ |
|
555
|
555
|
list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
|
556
|
556
|
|
|
@@ -654,13 +654,13 @@ discard block |
|
|
block discarded – undo |
|
654
|
654
|
} |
|
655
|
655
|
if ($e instanceof GenericEncryptionException) { |
|
656
|
656
|
// returning 503 will allow retry of the operation at a later point in time |
|
657
|
|
- throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
|
657
|
+ throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
658
|
658
|
} |
|
659
|
659
|
if ($e instanceof StorageNotAvailableException) { |
|
660
|
|
- throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
|
660
|
+ throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
661
|
661
|
} |
|
662
|
662
|
if ($e instanceof NotFoundException) { |
|
663
|
|
- throw new NotFound('File not found: ' . $e->getMessage(), 0, $e); |
|
|
663
|
+ throw new NotFound('File not found: '.$e->getMessage(), 0, $e); |
|
664
|
664
|
} |
|
665
|
665
|
|
|
666
|
666
|
throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |