|
@@ -123,7 +123,7 @@ discard block |
|
|
block discarded – undo |
|
123
|
123
|
throw new Forbidden(); |
|
124
|
124
|
} |
|
125
|
125
|
} catch (StorageNotAvailableException $e) { |
|
126
|
|
- throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
|
126
|
+ throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
127
|
127
|
} |
|
128
|
128
|
|
|
129
|
129
|
// verify path of the target |
|
@@ -146,7 +146,7 @@ discard block |
|
|
block discarded – undo |
|
146
|
146
|
|
|
147
|
147
|
if ($needsPartFile) { |
|
148
|
148
|
// mark file as partial while uploading (ignored by the scanner) |
|
149
|
|
- $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
|
149
|
+ $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
150
|
150
|
} else { |
|
151
|
151
|
// upload file directly as the final path |
|
152
|
152
|
$partFilePath = $this->path; |
|
@@ -206,7 +206,7 @@ discard block |
|
|
block discarded – undo |
|
206
|
206
|
$expected = $_SERVER['CONTENT_LENGTH']; |
|
207
|
207
|
} |
|
208
|
208
|
if ($expected !== "0") { |
|
209
|
|
- throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
|
209
|
+ throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
210
|
210
|
} |
|
211
|
211
|
} |
|
212
|
212
|
|
|
@@ -214,9 +214,9 @@ discard block |
|
|
block discarded – undo |
|
214
|
214
|
// double check if the file was fully received |
|
215
|
215
|
// compare expected and actual size |
|
216
|
216
|
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
|
217
|
|
- $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
|
217
|
+ $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
218
|
218
|
if ($count !== $expected) { |
|
219
|
|
- throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
|
219
|
+ throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
220
|
220
|
} |
|
221
|
221
|
} |
|
222
|
222
|
|
|
@@ -248,7 +248,7 @@ discard block |
|
|
block discarded – undo |
|
248
|
248
|
$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); |
|
249
|
249
|
$fileExists = $storage->file_exists($internalPath); |
|
250
|
250
|
if ($renameOkay === false || $fileExists === false) { |
|
251
|
|
- \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']); |
|
|
251
|
+ \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']); |
|
252
|
252
|
throw new Exception('Could not rename part file to final file'); |
|
253
|
253
|
} |
|
254
|
254
|
} catch (ForbiddenException $ex) { |
|
@@ -292,10 +292,10 @@ discard block |
|
|
block discarded – undo |
|
292
|
292
|
} |
|
293
|
293
|
|
|
294
|
294
|
} catch (StorageNotAvailableException $e) { |
|
295
|
|
- throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
|
295
|
+ throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
296
|
296
|
} |
|
297
|
297
|
|
|
298
|
|
- return '"' . $this->info->getEtag() . '"'; |
|
|
298
|
+ return '"'.$this->info->getEtag().'"'; |
|
299
|
299
|
} |
|
300
|
300
|
|
|
301
|
301
|
private function getPartFileBasePath($path) { |
|
@@ -382,9 +382,9 @@ discard block |
|
|
block discarded – undo |
|
382
|
382
|
return $res; |
|
383
|
383
|
} catch (GenericEncryptionException $e) { |
|
384
|
384
|
// returning 503 will allow retry of the operation at a later point in time |
|
385
|
|
- throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
|
385
|
+ throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
386
|
386
|
} catch (StorageNotAvailableException $e) { |
|
387
|
|
- throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
|
387
|
+ throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
388
|
388
|
} catch (ForbiddenException $ex) { |
|
389
|
389
|
throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
|
390
|
390
|
} catch (LockedException $e) { |
|
@@ -409,7 +409,7 @@ discard block |
|
|
block discarded – undo |
|
409
|
409
|
throw new Forbidden(); |
|
410
|
410
|
} |
|
411
|
411
|
} catch (StorageNotAvailableException $e) { |
|
412
|
|
- throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
|
412
|
+ throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
413
|
413
|
} catch (ForbiddenException $ex) { |
|
414
|
414
|
throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
|
415
|
415
|
} catch (LockedException $e) { |
|
@@ -472,11 +472,11 @@ discard block |
|
|
block discarded – undo |
|
472
|
472
|
//detect aborted upload |
|
473
|
473
|
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
|
474
|
474
|
if (isset($_SERVER['CONTENT_LENGTH'])) { |
|
475
|
|
- $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
|
475
|
+ $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
476
|
476
|
if ($bytesWritten !== $expected) { |
|
477
|
477
|
$chunk_handler->remove($info['index']); |
|
478
|
478
|
throw new BadRequest( |
|
479
|
|
- 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
|
479
|
+ 'expected filesize '.$expected.' got '.$bytesWritten); |
|
480
|
480
|
} |
|
481
|
481
|
} |
|
482
|
482
|
} |
|
@@ -487,7 +487,7 @@ discard block |
|
|
block discarded – undo |
|
487
|
487
|
$needsPartFile = $storage->needsPartFile(); |
|
488
|
488
|
$partFile = null; |
|
489
|
489
|
|
|
490
|
|
- $targetPath = $path . '/' . $info['name']; |
|
|
490
|
+ $targetPath = $path.'/'.$info['name']; |
|
491
|
491
|
/** @var \OC\Files\Storage\Storage $targetStorage */ |
|
492
|
492
|
list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
|
493
|
493
|
|
|
@@ -503,7 +503,7 @@ discard block |
|
|
block discarded – undo |
|
503
|
503
|
|
|
504
|
504
|
if ($needsPartFile) { |
|
505
|
505
|
// we first assembly the target file as a part file |
|
506
|
|
- $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
|
506
|
+ $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
507
|
507
|
/** @var \OC\Files\Storage\Storage $targetStorage */ |
|
508
|
508
|
list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
|
509
|
509
|
|
|
@@ -607,13 +607,13 @@ discard block |
|
|
block discarded – undo |
|
607
|
607
|
} |
|
608
|
608
|
if ($e instanceof GenericEncryptionException) { |
|
609
|
609
|
// returning 503 will allow retry of the operation at a later point in time |
|
610
|
|
- throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
|
610
|
+ throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
611
|
611
|
} |
|
612
|
612
|
if ($e instanceof StorageNotAvailableException) { |
|
613
|
|
- throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
|
613
|
+ throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
614
|
614
|
} |
|
615
|
615
|
if ($e instanceof NotFoundException) { |
|
616
|
|
- throw new NotFound('File not found: ' . $e->getMessage(), 0, $e); |
|
|
616
|
+ throw new NotFound('File not found: '.$e->getMessage(), 0, $e); |
|
617
|
617
|
} |
|
618
|
618
|
|
|
619
|
619
|
throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |