diff --git a/lib/StorageServer.php b/lib/StorageServer.php index 9e8c0f7..5b43e3d 100644 --- a/lib/StorageServer.php +++ b/lib/StorageServer.php @@ -84,10 +84,16 @@ public static function getFileSystem() { if (!self::storageIdExists($storageId)) { throw new \Exception("Storage does not exist"); } + if (is_dir(STORAGEBASE . "$storageId/")) { // backwards compatiblity check + $storagePath = $storageId; + } else { + $storagePath = implode("/", str_split($storageId, 4)); + } + // The internal adapter $adapter = new \League\Flysystem\Adapter\Local( // Determine root directory - STORAGEBASE . "$storageId/" + STORAGEBASE . "$storagePath/" ); $graph = new \EasyRdf\Graph(); diff --git a/lib/User.php b/lib/User.php index 2c1a748..bfb758b 100644 --- a/lib/User.php +++ b/lib/User.php @@ -269,11 +269,13 @@ public static function getUserById($userId) { } public static function getUserByWebId($webId) { - $idParts = explode(".", $webId, 2); - if ($idParts[1] !== BASEDOMAIN . "/#me") { + $webIdParts = parse_url($webId); + $idParts = explode(".", $webIdParts['host'], 2); + if ($idParts[1] !== BASEDOMAIN) { return false; } - $userId = preg_replace("/^id-/", "", $idParts[0]); + $userId = preg_replace("/^.*?id-/", "", $idParts[0]); + return self::getUserById($userId); }