@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | $this->server->on('propPatch', [$this, 'handleUpdateProperties']); |
| 138 | 138 | $this->server->on('afterBind', [$this, 'sendFileIdHeader']); |
| 139 | 139 | $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); |
| 140 | - $this->server->on('afterMethod:GET', [$this,'httpGet']); |
|
| 140 | + $this->server->on('afterMethod:GET', [$this, 'httpGet']); |
|
| 141 | 141 | $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); |
| 142 | - $this->server->on('afterResponse', function ($request, ResponseInterface $response): void { |
|
| 142 | + $this->server->on('afterResponse', function($request, ResponseInterface $response): void { |
|
| 143 | 143 | $body = $response->getBody(); |
| 144 | 144 | if (is_resource($body)) { |
| 145 | 145 | fclose($body); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | // Ensure source exists |
| 167 | 167 | $sourceNodeFileInfo = $sourceNode->getFileInfo(); |
| 168 | 168 | if ($sourceNodeFileInfo === null) { |
| 169 | - throw new NotFound($source . ' does not exist'); |
|
| 169 | + throw new NotFound($source.' does not exist'); |
|
| 170 | 170 | } |
| 171 | 171 | // Ensure the target name is valid |
| 172 | 172 | try { |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | // The source needs to be deletable for moving |
| 207 | 207 | $sourceNodeFileInfo = $sourceNode->getFileInfo(); |
| 208 | 208 | if (!$sourceNodeFileInfo->isDeletable()) { |
| 209 | - throw new Forbidden($source . ' cannot be deleted'); |
|
| 209 | + throw new Forbidden($source.' cannot be deleted'); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // The source is not allowed to be the parent of the target |
| 213 | - if (str_starts_with($source, $target . '/')) { |
|
| 214 | - throw new Forbidden($source . ' cannot be moved to it\'s parent'); |
|
| 213 | + if (str_starts_with($source, $target.'/')) { |
|
| 214 | + throw new Forbidden($source.' cannot be moved to it\'s parent'); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
| 266 | 266 | Request::USER_AGENT_FREEBOX, |
| 267 | 267 | ])) { |
| 268 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
| 268 | + $response->addHeader('Content-Disposition', 'attachment; filename="'.rawurlencode($filename).'"'); |
|
| 269 | 269 | } else { |
| 270 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
| 271 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
| 270 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($filename) |
|
| 271 | + . '; filename="'.rawurlencode($filename).'"'); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -304,15 +304,15 @@ discard block |
||
| 304 | 304 | * } |
| 305 | 305 | */ |
| 306 | 306 | |
| 307 | - $propFind->handle(self::FILEID_PROPERTYNAME, function () use ($node) { |
|
| 307 | + $propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) { |
|
| 308 | 308 | return $node->getFileId(); |
| 309 | 309 | }); |
| 310 | 310 | |
| 311 | - $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
| 311 | + $propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) { |
|
| 312 | 312 | return $node->getInternalFileId(); |
| 313 | 313 | }); |
| 314 | 314 | |
| 315 | - $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use ($node) { |
|
| 315 | + $propFind->handle(self::PERMISSIONS_PROPERTYNAME, function() use ($node) { |
|
| 316 | 316 | $perms = $node->getDavPermissions(); |
| 317 | 317 | if ($this->isPublic) { |
| 318 | 318 | // remove mount information |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return $perms; |
| 322 | 322 | }); |
| 323 | 323 | |
| 324 | - $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) { |
|
| 324 | + $propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) { |
|
| 325 | 325 | $user = $this->userSession->getUser(); |
| 326 | 326 | if ($user === null) { |
| 327 | 327 | return null; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | ); |
| 332 | 332 | }); |
| 333 | 333 | |
| 334 | - $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest): ?string { |
|
| 334 | + $propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest): ?string { |
|
| 335 | 335 | $user = $this->userSession->getUser(); |
| 336 | 336 | if ($user === null) { |
| 337 | 337 | return null; |
@@ -343,15 +343,15 @@ discard block |
||
| 343 | 343 | return json_encode($ocmPermissions, JSON_THROW_ON_ERROR); |
| 344 | 344 | }); |
| 345 | 345 | |
| 346 | - $propFind->handle(self::SHARE_ATTRIBUTES_PROPERTYNAME, function () use ($node, $httpRequest) { |
|
| 346 | + $propFind->handle(self::SHARE_ATTRIBUTES_PROPERTYNAME, function() use ($node, $httpRequest) { |
|
| 347 | 347 | return json_encode($node->getShareAttributes(), JSON_THROW_ON_ERROR); |
| 348 | 348 | }); |
| 349 | 349 | |
| 350 | - $propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node): string { |
|
| 350 | + $propFind->handle(self::GETETAG_PROPERTYNAME, function() use ($node): string { |
|
| 351 | 351 | return $node->getETag(); |
| 352 | 352 | }); |
| 353 | 353 | |
| 354 | - $propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node): ?string { |
|
| 354 | + $propFind->handle(self::OWNER_ID_PROPERTYNAME, function() use ($node): ?string { |
|
| 355 | 355 | $owner = $node->getOwner(); |
| 356 | 356 | if (!$owner) { |
| 357 | 357 | return null; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | return $owner->getUID(); |
| 360 | 360 | } |
| 361 | 361 | }); |
| 362 | - $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node): ?string { |
|
| 362 | + $propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function() use ($node): ?string { |
|
| 363 | 363 | $owner = $node->getOwner(); |
| 364 | 364 | if (!$owner) { |
| 365 | 365 | return null; |
@@ -385,13 +385,13 @@ discard block |
||
| 385 | 385 | return null; |
| 386 | 386 | }); |
| 387 | 387 | |
| 388 | - $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
| 388 | + $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function() use ($node) { |
|
| 389 | 389 | return json_encode($this->previewManager->isAvailable($node->getFileInfo()), JSON_THROW_ON_ERROR); |
| 390 | 390 | }); |
| 391 | - $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node): int|float { |
|
| 391 | + $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node): int | float { |
|
| 392 | 392 | return $node->getSize(); |
| 393 | 393 | }); |
| 394 | - $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { |
|
| 394 | + $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function() use ($node) { |
|
| 395 | 395 | return $node->getFileInfo()->getMountPoint()->getMountType(); |
| 396 | 396 | }); |
| 397 | 397 | |
@@ -401,18 +401,18 @@ discard block |
||
| 401 | 401 | * If so, then the node can only be unshared and not deleted. |
| 402 | 402 | * @see https://github.com/nextcloud/server/blob/cc75294eb6b16b916a342e69998935f89222619d/lib/private/Files/View.php#L696-L698 |
| 403 | 403 | */ |
| 404 | - $propFind->handle(self::MOUNT_ROOT_PROPERTYNAME, function () use ($node) { |
|
| 404 | + $propFind->handle(self::MOUNT_ROOT_PROPERTYNAME, function() use ($node) { |
|
| 405 | 405 | return $node->getNode()->getInternalPath() === '' ? 'true' : 'false'; |
| 406 | 406 | }); |
| 407 | 407 | |
| 408 | - $propFind->handle(self::SHARE_NOTE, function () use ($node): ?string { |
|
| 408 | + $propFind->handle(self::SHARE_NOTE, function() use ($node): ?string { |
|
| 409 | 409 | $user = $this->userSession->getUser(); |
| 410 | 410 | return $node->getNoteFromShare( |
| 411 | 411 | $user?->getUID() |
| 412 | 412 | ); |
| 413 | 413 | }); |
| 414 | 414 | |
| 415 | - $propFind->handle(self::SHARE_HIDE_DOWNLOAD_PROPERTYNAME, function () use ($node) { |
|
| 415 | + $propFind->handle(self::SHARE_HIDE_DOWNLOAD_PROPERTYNAME, function() use ($node) { |
|
| 416 | 416 | $storage = $node->getNode()->getStorage(); |
| 417 | 417 | if ($storage->instanceOfStorage(ISharedStorage::class)) { |
| 418 | 418 | /** @var ISharedStorage $storage */ |
@@ -425,23 +425,23 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | }); |
| 427 | 427 | |
| 428 | - $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () { |
|
| 428 | + $propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() { |
|
| 429 | 429 | return $this->config->getSystemValue('data-fingerprint', ''); |
| 430 | 430 | }); |
| 431 | - $propFind->handle(self::CREATIONDATE_PROPERTYNAME, function () use ($node) { |
|
| 431 | + $propFind->handle(self::CREATIONDATE_PROPERTYNAME, function() use ($node) { |
|
| 432 | 432 | return (new \DateTimeImmutable()) |
| 433 | 433 | ->setTimestamp($node->getFileInfo()->getCreationTime()) |
| 434 | 434 | ->format(\DateTimeInterface::ATOM); |
| 435 | 435 | }); |
| 436 | - $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) { |
|
| 436 | + $propFind->handle(self::CREATION_TIME_PROPERTYNAME, function() use ($node) { |
|
| 437 | 437 | return $node->getFileInfo()->getCreationTime(); |
| 438 | 438 | }); |
| 439 | 439 | |
| 440 | 440 | foreach ($node->getFileInfo()->getMetadata() as $metadataKey => $metadataValue) { |
| 441 | - $propFind->handle(self::FILE_METADATA_PREFIX . $metadataKey, $metadataValue); |
|
| 441 | + $propFind->handle(self::FILE_METADATA_PREFIX.$metadataKey, $metadataValue); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $propFind->handle(self::HIDDEN_PROPERTYNAME, function () use ($node) { |
|
| 444 | + $propFind->handle(self::HIDDEN_PROPERTYNAME, function() use ($node) { |
|
| 445 | 445 | $isLivePhoto = isset($node->getFileInfo()->getMetadata()['files-live-photo']); |
| 446 | 446 | $isMovFile = $node->getFileInfo()->getMimetype() === 'video/quicktime'; |
| 447 | 447 | return ($isLivePhoto && $isMovFile) ? 'true' : 'false'; |
@@ -453,18 +453,18 @@ discard block |
||
| 453 | 453 | * CustomPropertiesBackend (esp. visible when querying all files |
| 454 | 454 | * in a folder). |
| 455 | 455 | */ |
| 456 | - $propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) { |
|
| 456 | + $propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function() use ($node) { |
|
| 457 | 457 | return $node->getName(); |
| 458 | 458 | }); |
| 459 | 459 | |
| 460 | - $propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function () use ($node) { |
|
| 460 | + $propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function() use ($node) { |
|
| 461 | 461 | return $node->getFileInfo()->getMountPoint() |
| 462 | 462 | instanceof SharingExternalMount; |
| 463 | 463 | }); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | if ($node instanceof File) { |
| 467 | - $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use ($node) { |
|
| 467 | + $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) { |
|
| 468 | 468 | try { |
| 469 | 469 | $directDownloadUrl = $node->getDirectDownload(); |
| 470 | 470 | if (isset($directDownloadUrl['url'])) { |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | return false; |
| 479 | 479 | }); |
| 480 | 480 | |
| 481 | - $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function () use ($node) { |
|
| 481 | + $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function() use ($node) { |
|
| 482 | 482 | $checksum = $node->getChecksum(); |
| 483 | 483 | if ($checksum === null || $checksum === '') { |
| 484 | 484 | return null; |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | return new ChecksumList($checksum); |
| 488 | 488 | }); |
| 489 | 489 | |
| 490 | - $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) { |
|
| 490 | + $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function() use ($node) { |
|
| 491 | 491 | return $node->getFileInfo()->getUploadTime(); |
| 492 | 492 | }); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | if ($node instanceof Directory) { |
| 496 | - $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) { |
|
| 496 | + $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { |
|
| 497 | 497 | return $node->getSize(); |
| 498 | 498 | }); |
| 499 | 499 | |
@@ -556,20 +556,20 @@ discard block |
||
| 556 | 556 | return; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function ($time) use ($node) { |
|
| 559 | + $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($node) { |
|
| 560 | 560 | if (empty($time)) { |
| 561 | 561 | return false; |
| 562 | 562 | } |
| 563 | 563 | $node->touch($time); |
| 564 | 564 | return true; |
| 565 | 565 | }); |
| 566 | - $propPatch->handle(self::GETETAG_PROPERTYNAME, function ($etag) use ($node) { |
|
| 566 | + $propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($node) { |
|
| 567 | 567 | if (empty($etag)) { |
| 568 | 568 | return false; |
| 569 | 569 | } |
| 570 | 570 | return $node->setEtag($etag) !== -1; |
| 571 | 571 | }); |
| 572 | - $propPatch->handle(self::CREATIONDATE_PROPERTYNAME, function ($time) use ($node) { |
|
| 572 | + $propPatch->handle(self::CREATIONDATE_PROPERTYNAME, function($time) use ($node) { |
|
| 573 | 573 | if (empty($time)) { |
| 574 | 574 | return false; |
| 575 | 575 | } |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | $node->setCreationTime($dateTime->getTimestamp()); |
| 578 | 578 | return true; |
| 579 | 579 | }); |
| 580 | - $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function ($time) use ($node) { |
|
| 580 | + $propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function($time) use ($node) { |
|
| 581 | 581 | if (empty($time)) { |
| 582 | 582 | return false; |
| 583 | 583 | } |
| 584 | - $node->setCreationTime((int)$time); |
|
| 584 | + $node->setCreationTime((int) $time); |
|
| 585 | 585 | return true; |
| 586 | 586 | }); |
| 587 | 587 | |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | * Disable modification of the displayname property for files and |
| 592 | 592 | * folders via PROPPATCH. See PROPFIND for more information. |
| 593 | 593 | */ |
| 594 | - $propPatch->handle(self::DISPLAYNAME_PROPERTYNAME, function ($displayName) { |
|
| 594 | + $propPatch->handle(self::DISPLAYNAME_PROPERTYNAME, function($displayName) { |
|
| 595 | 595 | return 403; |
| 596 | 596 | }); |
| 597 | 597 | } |
@@ -622,15 +622,15 @@ discard block |
||
| 622 | 622 | |
| 623 | 623 | $propPatch->handle( |
| 624 | 624 | $mutation, |
| 625 | - function (mixed $value) use ($accessRight, $knownMetadata, $node, $mutation, $filesMetadataManager): bool { |
|
| 625 | + function(mixed $value) use ($accessRight, $knownMetadata, $node, $mutation, $filesMetadataManager): bool { |
|
| 626 | 626 | /** @var FilesMetadata $metadata */ |
| 627 | - $metadata = $filesMetadataManager->getMetadata((int)$node->getFileId(), true); |
|
| 627 | + $metadata = $filesMetadataManager->getMetadata((int) $node->getFileId(), true); |
|
| 628 | 628 | $metadata->setStorageId($node->getNode()->getStorage()->getCache()->getNumericStorageId()); |
| 629 | 629 | $metadataKey = substr($mutation, strlen(self::FILE_METADATA_PREFIX)); |
| 630 | 630 | |
| 631 | 631 | // confirm metadata key is editable via PROPPATCH |
| 632 | 632 | if ($knownMetadata->getEditPermission($metadataKey) < $accessRight) { |
| 633 | - throw new FilesMetadataException('you do not have enough rights to update \'' . $metadataKey . '\' on this node'); |
|
| 633 | + throw new FilesMetadataException('you do not have enough rights to update \''.$metadataKey.'\' on this node'); |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | if ($value === null) { |