fix: handle long/multiline prompts in _resolve_prompt
All checks were successful
Continuous Integration / Build Package (push) Successful in 31s
Continuous Integration / Lint, Check & Test (push) Successful in 51s

Skip the file-existence check when the prompt contains newlines (can't
be a filename) and catch OSError for prompts that exceed the OS path
length limit.
This commit is contained in:
Konstantin Fickel 2026-02-15 14:43:46 +01:00
parent 2aec223c5d
commit d1bbd95c1c
Signed by: kfickel
GPG key ID: A793722F9933C1A5

View file

@ -57,9 +57,14 @@ class BuildResult:
def _resolve_prompt(prompt_value: str, project_dir: Path) -> str:
"""Resolve a prompt: read from file if the path exists, otherwise use as-is."""
candidate = project_dir / prompt_value
if candidate.is_file():
return candidate.read_text()
if "\n" in prompt_value:
return prompt_value
try:
candidate = project_dir / prompt_value
if candidate.is_file():
return candidate.read_text()
except OSError:
pass
return prompt_value