Allow https links to the library of congress subject headings
This commit is contained in:
2 files changed
+7
-4
No files matched your search
@@ -353,7 +353,10 @@ private static function validateLocId(string $id):string|false {
|
||||
private static function validateLcshId(string $id):string|false {
|
||||
|
||||
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
|
||||
$id = strtr($id, ['http://id.loc.gov/authorities/names/' => '']);
|
||||
$id = strtr($id, [
|
||||
'http://id.loc.gov/authorities/names/' => '',
|
||||
'https://id.loc.gov/authorities/names/' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
if (substr($id, 0, 2) !== 'sh') {
|
||||
|
||||
@@ -40,9 +40,9 @@ public function testValidIdsValidate():void {
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
||||
|
||||
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("https://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("sh2022014604"));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user