From 0949b1b5070dd3c41e0d6c4b6d6e19163660aae8 Mon Sep 17 00:00:00 2001 From: nruest Date: Thu, 15 Feb 2024 16:01:11 -0500 Subject: [PATCH] Fix for OSD paged viewer isn't showing up on french pages. - Resolves https://redmine.library.yorku.ca/issues/3957 --- src/IIIFManifestParser.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/IIIFManifestParser.php b/src/IIIFManifestParser.php index e360aef..56820ae 100644 --- a/src/IIIFManifestParser.php +++ b/src/IIIFManifestParser.php @@ -82,7 +82,20 @@ public function getTileSources($manifest_url, $access_token = NULL) { // If the URL is relative, make it absolute. if (substr($manifest_url, 0, 4) !== "http") { $manifest_url = ltrim($manifest_url, '/'); - $manifest_url = Url::fromRoute('', [], ['absolute' => TRUE])->toString() . $manifest_url; + + // Check if the URL starts with "/fr/" and adjust accordingly. + // https://redmine.library.yorku.ca/issues/3957 + if (strpos($manifest_url, '/fr/') === 0) { + // If the URL starts with "/fr/", don't trim the first slash. + $append_slash = ''; + } + else { + // If the URL doesn't start with "/fr/", trim the first slash. + $append_slash = '/'; + } + + // Construct the absolute URL. + $manifest_url = Url::fromRoute('', [], ['absolute' => TRUE])->toString() . $append_slash . $manifest_url; } try {