Skip to content

Commit f6679c1

Browse files
committed
bugfixing drycoded controller
1 parent be8c783 commit f6679c1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

solid/lib/Controller/SolidWebhookController.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public function __construct($AppName, IRootFolder $rootFolder, IRequest $request
5353
$rawRequest = \Laminas\Diactoros\ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
5454
$this->webId = $this->DPop->getWebId($rawRequest);
5555
} catch(\Exception $e) {
56-
$response = $this->resourceServer->getResponse()->withStatus(409, "Invalid token");
57-
return $this->respond($response);
56+
return new PlainResponse("Invalid token", 409);
5857
}
5958
}
6059

@@ -124,7 +123,7 @@ private function getStorageUrl($userId) {
124123
$storageUrl = preg_replace('/foo$/', '', $storageUrl);
125124
return $storageUrl;
126125
}
127-
private function getAppBaseUrl($userId) {
126+
private function getAppBaseUrl() {
128127
$appBaseUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute("solid.app.appLauncher"));
129128
return $appBaseUrl;
130129
}
@@ -138,12 +137,15 @@ private function parseTargetUrl($targetUrl) {
138137
// targetUrl = https://nextcloud.server/solid/@alice/storage/foo/bar
139138
$appBaseUrl = $this->getAppBaseUrl(); // https://nextcloud.server/solid/
140139
$internalUrl = str_replace($appBaseUrl, '', $targetUrl); // @alice/storage/foo/bar
141-
$pathicles = explode($internalUrl, "/");
140+
$pathicles = explode("/", $internalUrl);
142141
$userId = $pathicles[0]; // alice
143142

144143
$storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/@alice/storage/
145144
$storagePath = str_replace($storageUrl, '/', $targetUrl); // /foo/bar
146-
return array("userId" => $userId, "path", $storagePath);
145+
return array(
146+
"userId" => $userId,
147+
"path" => $storagePath
148+
);
147149
}
148150

149151
private function createGetRequest($targetUrl) {

0 commit comments

Comments
 (0)