Remove query strings from GitHub URLs when creating a project

This commit is contained in:
Alex Cabal 2025-05-08 13:47:52 -05:00
parent afab78af46
commit 6805a13522

View file

@ -237,6 +237,8 @@ final class Project{
} }
elseif(preg_match('|^https?://(www\.)?github.com/|ius', $this->VcsUrl)){ elseif(preg_match('|^https?://(www\.)?github.com/|ius', $this->VcsUrl)){
$this->VcsUrl = rtrim($this->VcsUrl, '/'); $this->VcsUrl = rtrim($this->VcsUrl, '/');
// Remove query strings.
$this->VcsUrl = preg_replace('/\?[^\?]+$/iu', '', $this->VcsUrl);
if(!preg_match('|^https://github.com/[^/]+/[^/]+$|ius', $this->VcsUrl)){ if(!preg_match('|^https://github.com/[^/]+/[^/]+$|ius', $this->VcsUrl)){
$error->Add(new Exceptions\InvalidVcsUrlException($this->VcsUrl)); $error->Add(new Exceptions\InvalidVcsUrlException($this->VcsUrl));
} }