Fix long relative path handling on windows #302
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On windows long relative paths led to an error (see golang/go#21782). Here is a code example that fails (only on windows, on play it works): https://play.golang.org/p/wMS5gti4SD
To reproduce it you may use this on windows 10:
And then use the
afero.Walk
onC:\inetpub\wwwroot\something_4.0\
with a relative path traversal (e.g..
ornode_modules
).Other projects solve this problem in a similar way:
rclone
: https://github.com/rclone/rclone/blob/9e2fbe0f1a9314e1330b4adc9d69de137be12ee6/lib/file/unc_windows.go#L16restic
: https://github.com/restic/restic/blob/74c0607c9222edec3b0c140bb6fee962d6d2e82d/internal/fs/file_windows.go#L12