]> Cypherpunks.ru repositories - gostls13.git/commit
path/filepath: make Join handle UNC paths on Windows
authorEmil Hessman <emil@hessman.se>
Wed, 31 Dec 2014 05:27:31 +0000 (06:27 +0100)
committerAlex Brainman <alex.brainman@gmail.com>
Tue, 20 Jan 2015 23:23:01 +0000 (23:23 +0000)
commit8128b0116decc3b33e37a35d8d83182e2a19b61d
tree358946b1bc3e27d04fe3df58fba68cde1b45db4f
parent4e0618c99262260e5992dc77b60fa2fc93f8c9b6
path/filepath: make Join handle UNC paths on Windows

Unless the first element is a Universal Naming Convention (UNC)[0]
path, Join shouldn't create a UNC path on Windows.

For example, Join inadvertently creates a UNC path on Windows when
told to join at least three non-empty path elements, where the first
element is `\` or `/`.

This CL prevents creation of a UNC path prefix when the first path
element isn't a UNC path.

Since this introduces some amount of Windows-specific logic, Join is
moved to a per GOOS implementation.

Fixes #9167.

[0]: http://msdn.microsoft.com/en-us/library/gg465305.aspx

Change-Id: Ib6eda597106cb025137673b33c4828df1367f75b
Reviewed-on: https://go-review.googlesource.com/2211
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
src/path/filepath/path.go
src/path/filepath/path_plan9.go
src/path/filepath/path_test.go
src/path/filepath/path_unix.go
src/path/filepath/path_windows.go