during Put() fs returns client.PathInsufficientPermission{} for EPERM - fixes #1410

This commit is contained in:
Krishna Srinivas
2015-11-18 00:48:44 -08:00
parent d8c60b998c
commit e7002e097b
+6
View File
@@ -122,11 +122,17 @@ func (f *fsClient) Put(size int64, data io.Reader) *probe.Error {
objectPath := f.PathURL.Path
if objectDir != "" {
if err := os.MkdirAll(objectDir, 0700); err != nil {
if os.IsPermission(err) {
return probe.NewError(client.PathInsufficientPermission{Path: f.PathURL.Path})
}
return probe.NewError(err)
}
}
fs, err := os.Create(objectPath)
if err != nil {
if os.IsPermission(err) {
return probe.NewError(client.PathInsufficientPermission{Path: f.PathURL.Path})
}
return probe.NewError(err)
}
defer fs.Close()