Skip to content

archive: allow colons in filenames while keeping NTFS dotgit ADS checks - #2600

Closed
ansh-rohilla wants to merge 1 commit into
jelmer:mainfrom
ansh-rohilla:fix/archive-allow-colon-in-filename-2597
Closed

ansh-rohilla wants to merge 1 commit into
jelmer:mainfrom
ansh-rohilla:fix/archive-allow-colon-in-filename-2597

Conversation

@ansh-rohilla

Copy link
Copy Markdown

Fixes #2597.

Summary

  • Remove b":" from _UNSAFE_PATH_CHARS in dulwich/archive.py so ordinary tree entry filenames containing colons (such as usb:btusb) are exported by tar_stream, matching git archive and dulwich/index.py checkout path validation (index: match git on invalid checkout paths #2235).
  • Check each path component with _is_ntfs_dotgit from dulwich/index.py in _is_unsafe_archive_path() so NTFS .git / git~1 alternate-data-stream spellings (e.g. .git::$INDEX_ALLOCATION, .git:hidden, git~1:stream) remain rejected.
  • Update test_unsafe_paths_rejected and add test_colon_in_filename_allowed in tests/test_archive.py.

Testing

  • python3 -m unittest tests.test_archive tests.test_server -v (92 tests OK)
  • python3 -m unittest tests.test_archive tests.test_index -v (225 tests OK, 6 Windows-only skipped)
  • ruff check . & ruff format --check .
  • mypy dulwich/archive.py

@ansh-rohilla
ansh-rohilla requested a review from jelmer as a code owner November 27, 2026 12:38
@jelmer

jelmer commented Nov 27, 2026

Copy link
Copy Markdown
Owner

See AI policy.

@jelmer jelmer closed this Nov 27, 2026
@jelmer jelmer added the ai-slop Used to track AI slop submissions label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-slop Used to track AI slop submissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

archive: tar_stream refuses trees with a colon in a file name

2 participants