-
Notifications
You must be signed in to change notification settings - Fork 18.8k
integ-cli: Fix TestBuildAddBadLinks for windows #10871
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
Conversation
|
@@ -1568,7 +1569,18 @@ func TestBuildAddBadLinks(t *testing.T) { | |||
} | |||
defer os.RemoveAll(tempDir) | |||
|
|||
symlinkTarget := fmt.Sprintf("/../../../../../../../../../../../..%s", tempDir) | |||
var symlinkTarget string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't possible to make this with filepath.Join
without runtime.GOOS
comparing?
There was a problem hiding this comment.
Choose a reason for hiding this 8000 comment
The reason will be displayed to describe this comment to others. Learn more.
@LK4D4 great idea but as far as I can tell, no:
filepath.Join("/", "foo", "bar") → "\\foo\bar" (not a valid URL on windows)
since we need the volume letter (c:
) at the beginning I might give a full URL of where we're running:
filepath.Join(os.Getwd(), "..","..","..","..","..","..","..","..", "foo") → "c:\foo"
is still not what I want since filepath.Join clears the path from unnecessary stuff like "..". Any other ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense considering filepath.Join
doc:
The result is Cleaned, in particular all empty strings are ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember also there was filepath.Separator
or smth like that also. Not sure it worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LK4D4 you're right. it might help a bit but we still need to get the volume name c:
somehow.
TestBuildAddBadLinks used to build a path by concenating unix-style forward slashes. Fixed that by providing a windows-equivalent using `runtime.GOOS`. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Pushed the fix on this. Please review again. |
Wondering; would |
@thaJeztah not really. file:// doesn't work with pkg/os. |
@ahmetalpbalkan thanks. Kind of suspected it would be "too good to be true". |
LGTM |
1 similar comment
LGTM |
…Links-fix integ-cli: Fix TestBuildAddBadLinks for windows
TestBuildAddBadLinks used to build a path by
concenating unix-style forward slashes. Fixed that
by providing a windows-equivalent using
runtime.GOOS
.Signed-off-by: Ahmet Alp Balkan ahmetalpbalkan@gmail.com
cc: @unclejack @jfrazelle @icecrime @tiborvass