Skip to content

Preserve filename whitespace when combining an empty base - #604

Open
xiehuanyi wants to merge 1 commit into
PyFilesystem:masterfrom
xiehuanyi:fix-empty-base-whitespace
Open

xiehuanyi wants to merge 1 commit into
PyFilesystem:masterfrom
xiehuanyi:fix-empty-base-whitespace

Conversation

@xiehuanyi

Copy link
Copy Markdown

Fixes #603.

combine("", " report.txt") currently returns "report.txt", removing a character from a valid filename. The same path change occurs during MemoryFS.walk.files(path=""), so its returned path cannot be used to read the original file.

Return the supplied path unchanged when the base is empty. This preserves filename spaces/tabs and the existing behavior for leading slashes. Other path combination behavior is unchanged.

Validation: both new path and MemoryFS traversal regressions fail against upstream. All 2656 project tests pass on supported Python 3.10.20 (26 existing skips); Black 22.3 and flake8 checks pass. The local environment uses setuptools<81 for the existing pkg_resources import and pyftpdlib 1.5.9 within the project's declared range; pyftpdlib 1.5.10's test teardown expects a newer psutil API than the declared psutil 5.x dependency. No dependency files were changed.

Prepared with AI assistance and independently reviewed before submission.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

combine removes filename whitespace when the base is empty

2 participants