Remove whitespaces from vocabulary links, add dedicated exception for

lcsh links that are actually loc links
This commit is contained in:
2023-10-16 16:44:33 +02:00
parent da6e40282d
commit 1d1a690e0f
4 changed files with 31 additions and 2 deletions

View File

@ -36,7 +36,7 @@ final class MDNodaLink {
public function __construct(MDNodaRepository $source, string $id) {
$this->source = $source;
if (($validatedId = $this->source->validateId(trim($id))) === false) {
if (($validatedId = $this->source->validateId(strtr(trim($id), [" " => "", "\t" => "", "\n" => ""]))) === false) {
throw new MDInvalidNodaLink("Invalid noda ID / link: \"" . $id . "\" [Repository: " . $this->source->toDbName() . "]");
}
$this->id = $validatedId;