Add anchor to the start of preg_match()

Should have added these with bf631682
This commit is contained in:
Mike Colagrosso 2024-10-28 21:23:04 -06:00 committed by Alex Cabal
parent 19032b0bc2
commit 79533398ef

View file

@ -75,7 +75,7 @@ class Contributor{
}
if(isset($this->WikipediaUrl)){
if(!preg_match('|https://.*wiki.*|ius', $this->WikipediaUrl)){
if(!preg_match('|^https://.*wiki.*|ius', $this->WikipediaUrl)){
$error->Add(new Exceptions\InvalidContributorWikipediaUrlException('Invalid Contributor WikipediaUrl: ' . $this->WikipediaUrl));
}
@ -95,7 +95,7 @@ class Contributor{
}
if(isset($this->NacoafUrl)){
if(!preg_match('|https?://id\.loc\.gov/.*|ius', $this->NacoafUrl)){
if(!preg_match('|^https?://id\.loc\.gov/.*|ius', $this->NacoafUrl)){
$error->Add(new Exceptions\InvalidContributorNacoafUrlException('Invalid Contributor NacoafUrl: ' . $this->NacoafUrl));
}