Remove one level of indentation in swift path handling code
Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
This commit is contained in:
parent
75ce67c469
commit
4e619bc9b1
1 changed files with 10 additions and 8 deletions
|
@ -457,16 +457,18 @@ func (d *driver) swiftPath(path string) string {
|
|||
|
||||
func (d *driver) createParentFolder(path string) (string, error) {
|
||||
dir := gopath.Dir(path)
|
||||
if dir != "/" {
|
||||
if dir == "/" {
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
_, _, err := d.Conn.Object(d.Container, d.swiftPath(dir))
|
||||
if swiftErr, ok := err.(*swift.Error); ok && swiftErr.StatusCode == 404 {
|
||||
_, err := d.Conn.ObjectPut(d.Container, d.swiftPath(dir), bytes.NewReader(make([]byte, 0)),
|
||||
false, "", "application/directory", nil)
|
||||
false, "", directoryMimeType, nil)
|
||||
if err != nil {
|
||||
return dir, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dir, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue