Completed
Pull Request — master (#9473)
by Robin
23:08
created
apps/dav/lib/Connector/Sabre/File.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				throw new Forbidden();
122 122
 			}
123 123
 		} catch (StorageNotAvailableException $e) {
124
-			throw new ServiceUnavailable("File is not updatable: " . $e->getMessage());
124
+			throw new ServiceUnavailable("File is not updatable: ".$e->getMessage());
125 125
 		}
126 126
 
127 127
 		// verify path of the target
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
 		if ($needsPartFile) {
144 144
 			// mark file as partial while uploading (ignored by the scanner)
145
-			$partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part';
145
+			$partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part';
146 146
 		} else {
147 147
 			// upload file directly as the final path
148 148
 			$partFilePath = $this->path;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 				if (isset($_SERVER['CONTENT_LENGTH'])) {
180 180
 					$expected = $_SERVER['CONTENT_LENGTH'];
181 181
 				}
182
-				throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
182
+				throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )');
183 183
 			}
184 184
 
185 185
 			// if content length is sent by client:
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
189 189
 				$expected = (int) $_SERVER['CONTENT_LENGTH'];
190 190
 				if ($count !== $expected) {
191
-					throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
191
+					throw new BadRequest('expected filesize '.$expected.' got '.$count);
192 192
 				}
193 193
 			}
194 194
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 					$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath);
221 221
 					$fileExists = $storage->file_exists($internalPath);
222 222
 					if ($renameOkay === false || $fileExists === false) {
223
-						\OC::$server->getLogger()->error('renaming part file to final file failed ($run: ' . ( $run ? 'true' : 'false' ) . ', $renameOkay: '  . ( $renameOkay ? 'true' : 'false' ) . ', $fileExists: ' . ( $fileExists ? 'true' : 'false' ) . ')', ['app' => 'webdav']);
223
+						\OC::$server->getLogger()->error('renaming part file to final file failed ($run: '.($run ? 'true' : 'false').', $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']);
224 224
 						throw new Exception('Could not rename part file to final file');
225 225
 					}
226 226
 				} catch (ForbiddenException $ex) {
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 			}
265 265
 
266 266
 		} catch (StorageNotAvailableException $e) {
267
-			throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage());
267
+			throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage());
268 268
 		}
269 269
 
270
-		return '"' . $this->info->getEtag() . '"';
270
+		return '"'.$this->info->getEtag().'"';
271 271
 	}
272 272
 
273 273
 	private function getPartFileBasePath($path) {
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 			return $res;
355 355
 		} catch (GenericEncryptionException $e) {
356 356
 			// returning 503 will allow retry of the operation at a later point in time
357
-			throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage());
357
+			throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage());
358 358
 		} catch (StorageNotAvailableException $e) {
359
-			throw new ServiceUnavailable("Failed to open file: " . $e->getMessage());
359
+			throw new ServiceUnavailable("Failed to open file: ".$e->getMessage());
360 360
 		} catch (ForbiddenException $ex) {
361 361
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
362 362
 		} catch (LockedException $e) {
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 				throw new Forbidden();
382 382
 			}
383 383
 		} catch (StorageNotAvailableException $e) {
384
-			throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage());
384
+			throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage());
385 385
 		} catch (ForbiddenException $ex) {
386 386
 			throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry());
387 387
 		} catch (LockedException $e) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				if ($bytesWritten !== $expected) {
449 449
 					$chunk_handler->remove($info['index']);
450 450
 					throw new BadRequest(
451
-						'expected filesize ' . $expected . ' got ' . $bytesWritten);
451
+						'expected filesize '.$expected.' got '.$bytesWritten);
452 452
 				}
453 453
 			}
454 454
 		}
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$needsPartFile = $storage->needsPartFile();
460 460
 			$partFile = null;
461 461
 
462
-			$targetPath = $path . '/' . $info['name'];
462
+			$targetPath = $path.'/'.$info['name'];
463 463
 			/** @var \OC\Files\Storage\Storage $targetStorage */
464 464
 			list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
465 465
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
 				if ($needsPartFile) {
477 477
 					// we first assembly the target file as a part file
478
-					$partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
478
+					$partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part';
479 479
 					/** @var \OC\Files\Storage\Storage $targetStorage */
480 480
 					list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);
481 481
 
@@ -579,10 +579,10 @@  discard block
 block discarded – undo
579 579
 		}
580 580
 		if ($e instanceof GenericEncryptionException) {
581 581
 			// returning 503 will allow retry of the operation at a later point in time
582
-			throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e);
582
+			throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e);
583 583
 		}
584 584
 		if ($e instanceof StorageNotAvailableException) {
585
-			throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e);
585
+			throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e);
586 586
 		}
587 587
 
588 588
 		throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e);
Please login to merge, or discard this patch.