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 {