Remove trailing slashes from vocabulary links delivered as URLs

This commit is contained in:
Joshua Ramon Enslin 2023-12-01 16:45:49 +01:00
parent dcfba67422
commit 7912066f71
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 2 additions and 1 deletions

View File

@ -330,7 +330,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
foreach ($prefixes as $prefix) {
$toRemove[$prefix] = "";
}
$id = strtr($id, $toRemove);
$id = trim(strtr($id, $toRemove), '/');
}
if (!self::_is_numeric($id)) {

View File

@ -65,6 +65,7 @@ final class MDNodaRepositoryTest extends TestCase {
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("https://viaf.org/viaf/248941990"));
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("http://viaf.org/viaf/248941990"));
self::assertEquals("42893419", MDNodaRepository::viaf->validateId("https://viaf.org/viaf/42893419/"));
self::assertEquals("86145857811423020454", MDNodaRepository::viaf->validateId("86145857811423020454"));
self::assertEquals("2869150688328112660005", MDNodaRepository::viaf->validateId("2869150688328112660005"));
self::assertEquals(false, MDNodaRepository::viaf->validateId("2869150688328112;;660005"));