Skip to content

Commit ed05a31

Browse files
committed
remove try/catch - it returns public if not found
1 parent 50bd346 commit ed05a31

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

lib/Routes/SolidStorageProvider.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
namespace Pdsinterop\PhpSolid\Routes;
33

44
use Pdsinterop\PhpSolid\StorageServer;
5+
use Laminas\Diactoros\ServerRequestFactory;
56

67
class SolidStorageProvider {
78
public static function respondToStorageNew() {
8-
try {
9-
$webId = StorageServer::getWebId($rawRequest);
10-
11-
if (!isset($webId)) {
12-
$response = $resourceServer->getResponse()
13-
->withStatus(409, "Invalid token");
14-
StorageServer::respond($response);
15-
exit();
16-
}
17-
} catch (\Throwable $e) {
9+
$requestFactory = new ServerRequestFactory();
10+
$rawRequest = $requestFactory->fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
11+
$webId = StorageServer::getWebId($rawRequest);
12+
13+
if (!isset($webId) || $webId === "public") {
1814
$webId = $_POST['webId'];
1915
// FIXME: Check against a trusted remote party;
2016
}

0 commit comments

Comments
 (0)