From 1dc97e30e07f6a02721b419ab949dec1b29450d6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 28 Jan 2023 22:13:15 -0500 Subject: [PATCH 1/2] Read local files instead of performing self HTTP requests in JsonLD::documentLoader --- src/Util/JsonLD.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 8d609625e0..0a4d5a0b55 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -44,26 +44,26 @@ class JsonLD { switch ($url) { case 'https://w3id.org/security/v1': - $url = DI::baseUrl() . '/static/security-v1.jsonld'; + $url = DI::basePath() . '/static/security-v1.jsonld'; break; case 'https://w3id.org/identity/v1': - $url = DI::baseUrl() . '/static/identity-v1.jsonld'; + $url = DI::basePath() . '/static/identity-v1.jsonld'; break; case 'https://www.w3.org/ns/activitystreams': - $url = DI::baseUrl() . '/static/activitystreams.jsonld'; + $url = DI::basePath() . '/static/activitystreams.jsonld'; break; case 'https://funkwhale.audio/ns': - $url = DI::baseUrl() . '/static/funkwhale.audio.jsonld'; + $url = DI::basePath() . '/static/funkwhale.audio.jsonld'; break; default: switch (parse_url($url, PHP_URL_PATH)) { case '/schemas/litepub-0.1.jsonld'; - $url = DI::baseUrl() . '/static/litepub-0.1.jsonld'; + $url = DI::basePath() . '/static/litepub-0.1.jsonld'; break; case '/apschema/v1.2': case '/apschema/v1.9': case '/apschema/v1.10': - $url = DI::baseUrl() . '/static/apschema.jsonld'; + $url = DI::basePath() . '/static/apschema.jsonld'; break; default: Logger::info('Got url', ['url' =>$url]); From b66787f0deb2c3be3195e599cd26c57ba2892d47 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 28 Jan 2023 22:19:47 -0500 Subject: [PATCH 2/2] Improve return value consistency in Util\BasePath::getPath --- src/Util/BasePath.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/BasePath.php b/src/Util/BasePath.php index 1df92ea69c..4811239295 100644 --- a/src/Util/BasePath.php +++ b/src/Util/BasePath.php @@ -43,7 +43,7 @@ class BasePath } /** - * Returns the base filesystem path of the App + * Returns the base Friendica filesystem path without trailing slash * * It first checks for the internal variable, then for DOCUMENT_ROOT and * finally for PWD @@ -71,7 +71,7 @@ class BasePath throw new \Exception(sprintf('\'%s\' is not a valid basepath', $baseDir)); } - return $baseDir; + return rtrim($baseDir, '/'); } /**