mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Check --name value if it's passed in, as that's not validated anywhere
This commit is contained in:
parent
b4cf3d06fd
commit
e4b8fe85a1
1 changed files with 6 additions and 0 deletions
|
@ -171,6 +171,12 @@ EOT
|
|||
// package names must be in the format foo/bar
|
||||
$name = $name . '/' . $name;
|
||||
}
|
||||
} else {
|
||||
if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$name = $dialog->askAndValidate(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue