Closer approximate a fix for the validation of GND IDs

This commit is contained in:
jrenslin committed 2023-04-16 19:41:55 +02:00
1 parent fbc50d8198
commit 8e151e793f
1 file changed
+8 -2
+8 -2
View File
@@ -277,7 +277,13 @@ private static function validateGndId(string $id, array $prefixes):string|false
$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;
@@ -375,7 +381,7 @@ public function validateId(string $id):string|false {
self::bnf => self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]),
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::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::iconclass => self::validateIconclassId($id),
self::lcsh => self::validateLcshId($id),