archive: replace tarName() with filepath.ToSlash()#7344
Merged
kzys merged 1 commit intocontainerd:mainfrom Aug 30, 2022
Merged
Conversation
This code was copied from github.com/moby/moby/pkg/archive; moby/moby@28842d3, which got later simplified in moby/moby@a5aed69 This patch aligns the containerd implementation with those changes, and uses filepath.ToSlash() unconditionally on all platforms, as it's a no-op on platforms that use a forward-slash; https://github.com/golang/go/blob/go1.19/src/path/filepath/path.go#L175-L183 Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah
commented
Aug 30, 2022
Comment on lines
-33
to
-39
| // windows: convert windows style relative path with backslashes | ||
| // into forward slashes. Since windows does not allow '/' or '\' | ||
| // in file names, it is mostly safe to replace however we must | ||
| // check just in case | ||
| if strings.Contains(p, "/") { | ||
| return "", fmt.Errorf("windows path contains forward slash: %s", p) | ||
| } |
Member
Author
There was a problem hiding this comment.
This got removed in moby/moby@a5aed69 moby/moby#37356 (comment)
kzys
approved these changes
Aug 30, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This code was copied from github.com/moby/moby/pkg/archive; moby/moby@28842d3, which got later simplified in
moby/moby@a5aed69
This patch aligns the containerd implementation with those changes, and uses
filepath.ToSlash()unconditionally on all platforms, as it's a no-op on platforms that use a forward-slash; https://github.com/golang/go/blob/go1.19/src/path/filepath/path.go#L175-L183