Remove one level of indentation in swift path handling code

Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
This commit is contained in:
Sylvain Baubeau 2015-05-29 16:14:12 +02:00
parent 4497d6c973
commit c4d845cb6c

View file

@ -457,16 +457,18 @@ func (d *driver) swiftPath(path string) string {
func (d *driver) createParentFolder(path string) (string, error) { func (d *driver) createParentFolder(path string) (string, error) {
dir := gopath.Dir(path) dir := gopath.Dir(path)
if dir != "/" { if dir == "/" {
return dir, nil
}
_, _, err := d.Conn.Object(d.Container, d.swiftPath(dir)) _, _, err := d.Conn.Object(d.Container, d.swiftPath(dir))
if swiftErr, ok := err.(*swift.Error); ok && swiftErr.StatusCode == 404 { if swiftErr, ok := err.(*swift.Error); ok && swiftErr.StatusCode == 404 {
_, err := d.Conn.ObjectPut(d.Container, d.swiftPath(dir), bytes.NewReader(make([]byte, 0)), _, err := d.Conn.ObjectPut(d.Container, d.swiftPath(dir), bytes.NewReader(make([]byte, 0)),
false, "", "application/directory", nil) false, "", directoryMimeType, nil)
if err != nil { if err != nil {
return dir, err return dir, err
} }
} }
}
return dir, nil return dir, nil
} }