Skip to content

Foundation: correct directory iteration on Windows #4745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jun 2, 2023

The path that was being constructed would elide the penultimate arc in the path as the base URL was not marked as a directory. As such, it was assumed to be a file URL, and making a URL relative to it would truncate the previously last arc. Append the path component instead and explicitly indicate if it is a directory component when building the URL as we already have the information on hand.

This repairs the directory traversal on Windows. The bug was identified by the DocC test suite on Windows.

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2023

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

compnerd commented Jun 4, 2023

@swift-ci please test Linux platform

@compnerd
Copy link
Member Author

compnerd commented Jun 4, 2023

@swift-ci please test Linux platform

1 similar comment
@compnerd
Copy link
Member Author

compnerd commented Jun 4, 2023

@swift-ci please test Linux platform

The path that was being constructed would elide the penultimate arc in
the path as the base URL was not marked as a directory.  As such, it was
assumed to be a file URL, and making a URL relative to it would truncate
the previously last arc.  Append the path component instead and
explicitly indicate if it is a directory component when building the URL
as we already have the information on hand.

This repairs the directory traversal on Windows.  The bug was identified
by the DocC test suite on Windows.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@compnerd compnerd merged commit 4eacf88 into swiftlang:main Jun 12, 2023
@compnerd compnerd deleted the traversal branch June 12, 2023 20:36
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.

1 participant