mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Do not allow ":" and "/" chars in a package name
This commit is contained in:
@ -149,7 +149,13 @@ class ExampleSchema(StrictSchema):
|
||||
|
||||
class ManifestSchema(BaseSchema):
|
||||
# Required fields
|
||||
name = fields.Str(required=True, validate=validate.Length(min=1, max=100))
|
||||
name = fields.Str(
|
||||
required=True,
|
||||
validate=[
|
||||
validate.Length(min=1, max=100),
|
||||
validate.Regexp(r"^[^:/]+$", error="The next chars [:/] are not allowed"),
|
||||
],
|
||||
)
|
||||
version = fields.Str(required=True, validate=validate.Length(min=1, max=50))
|
||||
|
||||
# Optional fields
|
||||
|
@ -841,3 +841,7 @@ def test_broken_schemas():
|
||||
version="1.2.3",
|
||||
)
|
||||
)
|
||||
|
||||
# invalid package name
|
||||
with pytest.raises(ManifestValidationError, match=("are not allowed")):
|
||||
ManifestSchema().load_manifest(dict(name="C/C++ :library", version="1.2.3"))
|
||||
|
Reference in New Issue
Block a user