code_puppy icon indicating copy to clipboard operation
code_puppy copied to clipboard

fix: attachment parser crash from visual dividers and improve comment detection

Open diegonix opened this issue 2 months ago • 0 comments

Fix attachment parser crash from visual dividers and improve comment detection

Prevent OSError: File name too long crashes when CLI output containing screen drawing characters is misinterpreted as file paths. The parser was incorrectly processing sequences like "/" followed by repeated Unicode box drawing characters as valid filesystem paths.

Key changes:

  • Add comprehensive Unicode box drawing character detection: ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ║ ╚ ╝ ╔ ╗ ╠ ╣ ╦ ╩ ╬ ━ ┃ ┏ ┓ ┗ ┛ ┣ ┫ ┳ ┻ ╋
  • Add line separator and decorative characters: - = — – • · ○ ● ■ □ ░ ▒ ▓ █ ▄ ▌ ▐ ▀ ╭ ╮ ╯ ╰
  • Implement 50% threshold rule: exclude tokens where >50% of non-slash characters are dividers
  • Enhance comment detection with whitespace support for #, #, //, /*, ;, --, !, %, rem, REM, Note:
  • Add OSError protection around unhandled path.exists() call at line 270
  • Preserve all valid path functionality including Unicode characters in filenames

This fix prevents crashes from CLI output containing visual dividers while maintaining full compatibility with legitimate file paths that may contain Unicode characters.

diegonix avatar Oct 21 '25 01:10 diegonix