Skip to content

fix(parser): hash & shorten filenames that exceed filesystem limit#205

Merged
MaojiaSheng merged 1 commit intovolcengine:mainfrom
DevEverything01:fix/filename-too-long
Feb 18, 2026
Merged

fix(parser): hash & shorten filenames that exceed filesystem limit#205
MaojiaSheng merged 1 commit intovolcengine:mainfrom
DevEverything01:fix/filename-too-long

Conversation

@DevEverything01
Copy link
Contributor

Summary

Fix "file name too long" error when adding resources with long titles or section headings (e.g., shell scripts whose # comments are treated as markdown headings).

When filenames exceed the OS limit, they are now truncated with a SHA-256 hash suffix to preserve uniqueness.

Type of Change

  • Bug fix (fix)

Testing

  • Unit tests pass (tests/parse/test_filename_safety.py — 23 new tests)
  • Manual testing completed

Related Issues

Checklist

  • Code follows project style guidelines
  • Tests added for new functionality
  • All tests pass

When parsing documents with long titles or section headings (e.g., shell
scripts whose comments are treated as markdown headings), the generated
filenames could exceed the OS 255-byte limit, causing 'file name too long'
errors.

Fix:
- _sanitize_for_path: append SHA-256 hash suffix when truncating, ensuring
  uniqueness across different long titles that share a common prefix
- _generate_merged_filename: apply same hash-based truncation
- _generate_filename (downloader): apply same pattern
- VikingFS._uri_to_path: add safety net that shortens any path component
  exceeding 255 bytes, guaranteeing no filesystem error regardless of
  which parser produced the URI

Fixes volcengine#171
@MaojiaSheng MaojiaSheng merged commit 361cad6 into volcengine:main Feb 18, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: filename too long

2 participants