Fix the issue for listing root directory

Change-Id: I1c6181fa4e5666bd2e6ec69cb608c4778ae0fe48
Signed-off-by: Li Yi <denverdino@gmail.com>
This commit is contained in:
Li Yi 2015-12-08 19:55:28 +08:00 committed by Stephen J Day
parent 7161fa0559
commit b6756a3d89

View file

@ -666,10 +666,10 @@ func (d *driver) List(ctx context.Context, path string) ([]string, error) {
listResponse, err := d.Bucket.List(d.ossPath(path), "/", "", listMax) listResponse, err := d.Bucket.List(d.ossPath(path), "/", "", listMax)
if err != nil { if err != nil {
return nil, err return nil, parseError(path, err)
} }
if len(listResponse.Contents) == 0 { if len(listResponse.Contents) == 0 && path != "/" {
// Treat empty response as missing directory, since we don't actually // Treat empty response as missing directory, since we don't actually
// have directories in OSS. // have directories in OSS.
return nil, storagedriver.PathNotFoundError{Path: path} return nil, storagedriver.PathNotFoundError{Path: path}