Skip to content

Commit c57678b

Browse files
committed
fixing
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent f47b83b commit c57678b

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

lib/private/WellKnown/Exceptions/NotManagedWellKnownRequestException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class NotManagedWellKnownRequestException extends Exception {
5151
* @param int $code
5252
* @param Throwable|null $previous
5353
*/
54-
public function __construct($errorCode = 404, $message = "", $code = 0, Throwable $previous = null) {
54+
public function __construct(int $errorCode = 404, string $message = "", int $code = 0, ?Throwable $previous = null) {
5555
parent::__construct($message, $code, $previous);
5656
$this->errorCode = $errorCode;
5757
}

lib/private/WellKnown/Exceptions/WellKnownRequestException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class WellKnownRequestException extends Exception {
5151
* @param int $code
5252
* @param Throwable|null $previous
5353
*/
54-
public function __construct($errorCode = 404, $message = "", $code = 0, Throwable $previous = null) {
54+
public function __construct(int $errorCode = 404, string $message = "", int $code = 0, ?Throwable $previous = null) {
5555
parent::__construct($message, $code, $previous);
5656
$this->errorCode = $errorCode;
5757
}

lib/private/WellKnown/Model/WellKnown.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ public function getProperties(): array {
168168

169169

170170
/**
171-
* @param array $arr
171+
* @param array $links
172172
*
173173
* @return IWellKnown
174174
* @since 21.0.0
175175
*/
176-
public function addLink(array $arr): IWellKnown {
177-
$this->links[] = $arr;
176+
public function addLink(array $links): IWellKnown {
177+
$this->links[] = $links;
178178

179179
return $this;
180180
}

lib/private/WellKnown/WellKnownManager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use OC\WellKnown\Exceptions\NotManagedWellKnownRequestException;
3131
use OC\WellKnown\Exceptions\WellKnownRequestException;
3232
use OC\WellKnown\Model\WellKnown;
33+
use OCP\AppFramework\Http;
3334
use OCP\EventDispatcher\IEventDispatcher;
3435
use OCP\IRequest;
3536
use OCP\WellKnown\Event\WellKnownEvent;
@@ -82,14 +83,14 @@ public function __construct(IEventDispatcher $eventDispatcher) {
8283
public function manageRequest(IRequest $request): IWellKnown {
8384
$service = $request->getParam('service', '');
8485
if (!in_array($service, $this->managedServices)) {
85-
throw new NotManagedWellKnownRequestException(404);
86+
throw new NotManagedWellKnownRequestException(Http::STATUS_NOT_FOUND);
8687
}
8788

8889
$wellKnown = new WellKnown($service, $request);
8990
$this->eventDispatcher->dispatchTyped(new WellKnownEvent($wellKnown));
9091

9192
if ($this->isEmpty($wellKnown)) {
92-
throw new WellKnownRequestException(404);
93+
throw new WellKnownRequestException(Http::STATUS_NOT_FOUND);
9394
}
9495

9596
return $wellKnown;

public.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@
6161
list($service) = explode('/', $pathInfo);
6262
}
6363

64-
// Managing some .well-known request
64+
OC_App::loadApps(['authentication']);
65+
OC_App::loadApps(['filesystem', 'logging']);
6566
OC_App::loadApps();
67+
68+
// Managing some .well-known request
6669
try {
6770
/** @var IWellKnownManager $manager */
68-
$manager = \OC::$server->query(WellKnownManager::class);
71+
$manager = \OC::$server->get(WellKnownManager::class);
6972
$wellKnown = $manager->manageRequest($request);
7073
header('Content-type: application/json');
7174
echo json_encode($wellKnown);
@@ -88,14 +91,11 @@
8891

8992
// Load all required applications
9093
\OC::$REQUESTEDAPP = $app;
91-
// OC_App::loadApps(['authentication']); // should not be needed anymore
92-
// OC_App::loadApps(['filesystem', 'logging']);
9394

9495
if (!\OC::$server->getAppManager()->isInstalled($app)) {
9596
http_response_code(404);
9697
exit;
9798
}
98-
// OC_App::loadApp($app);
9999
OC_User::setIncognitoMode(true);
100100

101101
$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';

0 commit comments

Comments
 (0)