WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Fix SyntaxError in `validate-modern.py` due to unescaped newline in f-string

Open jiaxing-liu opened this issue 7 months ago • 0 comments

Summary of the Pull Request

PR Checklist

  • [x] Closes: Link to issue #12976
  • [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [ ] Tests: Added/updated if needed and all pass
  • [ ] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated if needed
  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

This PR pre-processes the escaped output before formatting it in the f-string. The updated code:

escaped = format_list(text).replace('\n', '%0A')
print(f'::error file={manifest},line={line}::Error: {escaped}')

Validation Steps Performed

It works find locally.

$ python validate-modern.py --tar gentoo_20250525.wsl
Found valid keys in "./etc/wsl-distribution.conf": ['oobe.command', 'oobe.defaultname', 'shortcut.enabled', 'shortcut.icon']
Found valid keys in "./etc/wsl.conf": []

jiaxing-liu avatar May 26 '25 12:05 jiaxing-liu