Fix all remaining windows path issues.

This commit is contained in:
Harshavardhana
2015-10-21 22:25:13 -07:00
parent 8978c19db6
commit 1f66f4869b
5 changed files with 49 additions and 12 deletions
+4
View File
@@ -118,6 +118,7 @@ func getMetadata(rootPath, bucket, object string) (ObjectMetadata, *probe.Error)
// Do not use filepath.Join() since filepath.Join strips off any object names with '/', use them as is
// in a static manner so that we can send a proper 'ObjectNotFound' reply back upon os.Stat()
var objectPath string
// For windows use its special os.PathSeparator == "\\"
if runtime.GOOS == "windows" {
objectPath = rootPath + string(os.PathSeparator) + bucket + string(os.PathSeparator) + object
} else {
@@ -131,6 +132,9 @@ func getMetadata(rootPath, bucket, object string) (ObjectMetadata, *probe.Error)
return ObjectMetadata{}, probe.NewError(err)
}
contentType := "application/octet-stream"
if runtime.GOOS == "windows" {
object = sanitizeWindowsPath(object)
}
metadata := ObjectMetadata{
Bucket: bucket,
Object: object,