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(
|
required_files: List[str] = Field(
|
||||||
[], validation_alias=AliasChoices("required-files", "required_files")
|
[], validation_alias=AliasChoices("required-files", "required_files")
|
||||||
)
|
)
|
||||||
whitelisted_chars: List[str] = Field(
|
whitelisted_chars: str = Field(
|
||||||
[], validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars")
|
"", validation_alias=AliasChoices("whitelisted-chars", "whitelisted_chars")
|
||||||
)
|
)
|
||||||
|
|
||||||
@field_validator("max_size", mode="before")
|
@field_validator("max_size", mode="before")
|
||||||
|
|
@ -63,12 +63,8 @@ class HealthCheck(StrictBaseModel):
|
||||||
|
|
||||||
@field_validator("whitelisted_chars")
|
@field_validator("whitelisted_chars")
|
||||||
@classmethod
|
@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:
|
for c in chars:
|
||||||
if len(c) != 1:
|
|
||||||
raise ValueError(
|
|
||||||
"Each whitelisted character must be exactly one character"
|
|
||||||
)
|
|
||||||
if c.isascii():
|
if c.isascii():
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Each whitelisted character must be a non-ASCII character"
|
"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:
|
if repo_conf.health_check.whitelisted_chars:
|
||||||
args.append(
|
args.append(
|
||||||
f"-whitelistedChars={','.join(repo_conf.health_check.whitelisted_chars)}"
|
f"-whitelistedChars={','.join(list(repo_conf.health_check.whitelisted_chars))}"
|
||||||
)
|
)
|
||||||
args.extend(
|
args.extend(
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
health-check.whitelisted-chars = ["你", "好", "!"]
|
health-check.whitelisted-chars = "你好!"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user