feat: use TOML string instead of array for non-ASCII chars

This commit is contained in:
王韵晨520370910012 2026-04-21 18:51:10 -07:00
parent 51392cc156
commit 175eeb045e
GPG Key ID: F28AB6AE26FFED6F
3 changed files with 5 additions and 9 deletions

View File

@ -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"

View File

@ -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(
[

View File

@ -1 +1 @@
health-check.whitelisted-chars = ["你", "", ""]
health-check.whitelisted-chars = "你好!"