Skip to content

Commit c441e79

Browse files
authored
Merge pull request #27 from pdsinterop/feature/fragment-storage-path
split up storage path into fragments
2 parents 5191a75 + ad6a834 commit c441e79

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

lib/StorageServer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,16 @@ public static function getFileSystem() {
8484
if (!self::storageIdExists($storageId)) {
8585
throw new \Exception("Storage does not exist");
8686
}
87+
if (is_dir(STORAGEBASE . "$storageId/")) { // backwards compatiblity check
88+
$storagePath = $storageId;
89+
} else {
90+
$storagePath = implode("/", str_split($storageId, 4));
91+
}
92+
8793
// The internal adapter
8894
$adapter = new \League\Flysystem\Adapter\Local(
8995
// Determine root directory
90-
STORAGEBASE . "$storageId/"
96+
STORAGEBASE . "$storagePath/"
9197
);
9298

9399
$graph = new \EasyRdf\Graph();

lib/User.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,13 @@ public static function getUserById($userId) {
269269
}
270270

271271
public static function getUserByWebId($webId) {
272-
$idParts = explode(".", $webId, 2);
273-
if ($idParts[1] !== BASEDOMAIN . "/#me") {
272+
$webIdParts = parse_url($webId);
273+
$idParts = explode(".", $webIdParts['host'], 2);
274+
if ($idParts[1] !== BASEDOMAIN) {
274275
return false;
275276
}
276-
$userId = preg_replace("/^id-/", "", $idParts[0]);
277+
$userId = preg_replace("/^.*?id-/", "", $idParts[0]);
278+
277279
return self::getUserById($userId);
278280
}
279281

0 commit comments

Comments
 (0)