feat: use TOML string instead of array for non-ASCII chars
This commit is contained in:
parent
51392cc156
commit
175eeb045e
|
|
@ -50,8 +50,8 @@ class HealthCheck(StrictBaseModel):
|
|||
required_files: List[str] = Field(
|
||||
[], validation_alias=AliasChoices("required-files", "required_files")
|
||||
)
|
||||
whitelisted_chars: List[str] = Field(
|
||||
[], validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars")
|
||||
whitelisted_chars: str = Field(
|
||||
"", validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars")
|
||||
)
|
||||
|
||||
@field_validator("max_size", mode="before")
|
||||
|
|
@ -63,12 +63,8 @@ class HealthCheck(StrictBaseModel):
|
|||
|
||||
@field_validator("whitelisted_chars")
|
||||
@classmethod
|
||||
def ensure_non_ascii_single_char_list(cls, chars: List[str]) -> List[str]:
|
||||
def ensure_non_ascii_chars(cls, chars: str) -> str:
|
||||
for c in chars:
|
||||
if len(c) != 1:
|
||||
raise ValueError(
|
||||
"Each whitelisted character must be exactly one character"
|
||||
)
|
||||
if c.isascii():
|
||||
raise ValueError(
|
||||
"Each whitelisted character must be a non-ASCII character"
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ def get_health_check_args(repo_conf: repo.Config) -> List[str]:
|
|||
]
|
||||
if repo_conf.health_check.whitelisted_chars:
|
||||
args.append(
|
||||
f"-whitelistedChars={','.join(repo_conf.health_check.whitelisted_chars)}"
|
||||
f"-whitelistedChars={','.join(list(repo_conf.health_check.whitelisted_chars))}"
|
||||
)
|
||||
args.extend(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
health-check.whitelisted-chars = ["你", "好", "!"]
|
||||
health-check.whitelisted-chars = "你好!"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user