Passed
Push — master ( 135209...a3bf8a )
by Roeland
21:49 queued 11:29
created
apps/dav/lib/Connector/Sabre/File.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				throw new Forbidden();
125 125
 			}
126 126
 		} catch (StorageNotAvailableException $e) {
127
-			throw new ServiceUnavailable("File is not updatable: " . $e->getMessage());
127
+			throw new ServiceUnavailable("File is not updatable: ".$e->getMessage());
128 128
 		}
129 129
 
130 130
 		// verify path of the target
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 		if ($needsPartFile) {
149 149
 			// mark file as partial while uploading (ignored by the scanner)
150
-			$partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part';
150
+			$partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part';
151 151
 
152 152
 			if (!$view->isCreatable($partFilePath) && $view->isUpdatable($this->path)) {
153 153
 				$needsPartFile = false;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				}
185 185
 
186 186
 				$isEOF = false;
187
-				$wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function ($stream) use (&$isEOF) {
187
+				$wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) {
188 188
 					$isEOF = feof($stream);
189 189
 				});
190 190
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 					$expected = $_SERVER['CONTENT_LENGTH'];
216 216
 				}
217 217
 				if ($expected !== "0") {
218
-					throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
218
+					throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )');
219 219
 				}
220 220
 			}
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 			// double check if the file was fully received
224 224
 			// compare expected and actual size
225 225
 			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
226
-				$expected = (int)$_SERVER['CONTENT_LENGTH'];
226
+				$expected = (int) $_SERVER['CONTENT_LENGTH'];
227 227
 				if ($count !== $expected) {
228
-					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.');
228
+					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.');
229 229
 				}
230 230
 			}
231 231
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 					$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath);
264 264
 					$fileExists = $storage->file_exists($internalPath);
265 265
 					if ($renameOkay === false || $fileExists === false) {
266
-						\OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']);
266
+						\OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']);
267 267
 						throw new Exception('Could not rename part file to final file');
268 268
 					}
269 269
 				} catch (ForbiddenException $ex) {
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 			}
308 308
 
309 309
 		} catch (StorageNotAvailableException $e) {
310
-			throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e);
310
+			throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage(), 0, $e);
311 311
 		}
312 312
 
313
-		return '"' . $this->info->getEtag() . '"';
313
+		return '"'.$this->info->getEtag().'"';
314 314
 	}
315 315
 
316 316
 	private function getPartFileBasePath($path) {
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 			return $res;
398 398
 		} catch (GenericEncryptionException $e) {
399 399
 			// returning 503 will allow retry of the operation at a later point in time
400
-			throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage());
400
+			throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage());
401 401
 		} catch (StorageNotAvailableException $e) {
402
-			throw new ServiceUnavailable("Failed to open file: " . $e->getMessage());
402
+			throw new ServiceUnavailable("Failed to open file: ".$e->getMessage());
403 403
 		} catch (ForbiddenException $ex) {
404 404
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
405 405
 		} catch (LockedException $e) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 				throw new Forbidden();
425 425
 			}
426 426
 		} catch (StorageNotAvailableException $e) {
427
-			throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage());
427
+			throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage());
428 428
 		} catch (ForbiddenException $ex) {
429 429
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
430 430
 		} catch (LockedException $e) {
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
 		//detect aborted upload
488 488
 		if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
489 489
 			if (isset($_SERVER['CONTENT_LENGTH'])) {
490
-				$expected = (int)$_SERVER['CONTENT_LENGTH'];
490
+				$expected = (int) $_SERVER['CONTENT_LENGTH'];
491 491
 				if ($bytesWritten !== $expected) {
492 492
 					$chunk_handler->remove($info['index']);
493
-					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.');
493
+					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.');
494 494
 				}
495 495
 			}
496 496
 		}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			$needsPartFile = $storage->needsPartFile();
502 502
 			$partFile = null;
503 503
 
504
-			$targetPath = $path . '/' . $info['name'];
504
+			$targetPath = $path.'/'.$info['name'];
505 505
 			/** @var \OC\Files\Storage\Storage $targetStorage */
506 506
 			list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
507 507
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
 				if ($needsPartFile) {
519 519
 					// we first assembly the target file as a part file
520
-					$partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
520
+					$partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part';
521 521
 					/** @var \OC\Files\Storage\Storage $targetStorage */
522 522
 					list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);
523 523
 
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 		}
622 622
 		if ($e instanceof GenericEncryptionException) {
623 623
 			// returning 503 will allow retry of the operation at a later point in time
624
-			throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e);
624
+			throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e);
625 625
 		}
626 626
 		if ($e instanceof StorageNotAvailableException) {
627
-			throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e);
627
+			throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e);
628 628
 		}
629 629
 		if ($e instanceof NotFoundException) {
630
-			throw new NotFound('File not found: ' . $e->getMessage(), 0, $e);
630
+			throw new NotFound('File not found: '.$e->getMessage(), 0, $e);
631 631
 		}
632 632
 
633 633
 		throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e);
Please login to merge, or discard this patch.