Closer approximate a fix for the validation of GND IDs

This commit is contained in:
Joshua Ramon Enslin 2023-04-16 19:41:55 +02:00
parent fbc50d8198
commit 8e151e793f
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -277,7 +277,13 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
$id = strtr($id, $toRemove); $id = strtr($id, $toRemove);
} }
if (preg_match("/^[0-9-X]*$/", $id) === false) return false; // There is an issue with this regex
if (preg_match("/^[0-9-X]*$/", $id) === false) {
return false;
}
if (is_numeric(strtr($id, ['-' => '', 'X' => ''])) === false) {
return false;
}
return $id; return $id;
@ -375,7 +381,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
self::bnf => self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]), self::bnf => self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]),
self::cona => self::validateNumericId($id, ['https://vocab.getty.edu/page/cona/']), self::cona => self::validateNumericId($id, ['https://vocab.getty.edu/page/cona/']),
self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']), self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']),
self::gnd => self::validateGndId($id, ['https://d-nb.info/gnd/']), self::gnd => self::validateGndId($id, ['http://d-nb.info/gnd/', 'https://d-nb.info/gnd/']),
self::grobsystematik => self::validateNumericId($id, ['https://term.museum-digital.de/grobsystematik/tag/']), self::grobsystematik => self::validateNumericId($id, ['https://term.museum-digital.de/grobsystematik/tag/']),
self::iconclass => self::validateIconclassId($id), self::iconclass => self::validateIconclassId($id),
self::lcsh => self::validateLcshId($id), self::lcsh => self::validateLcshId($id),