|
|
@ -20,6 +20,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"net" |
|
|
|
"net" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
jwtgo "github.com/dgrijalva/jwt-go" |
|
|
|
jwtgo "github.com/dgrijalva/jwt-go" |
|
|
@ -95,19 +96,22 @@ func (web *WebAPI) ListObjects(r *http.Request, args *ListObjectsArgs, reply *[] |
|
|
|
if object.Err != nil { |
|
|
|
if object.Err != nil { |
|
|
|
return object.Err |
|
|
|
return object.Err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
objectInfo := ObjectInfo{ |
|
|
|
|
|
|
|
Key: object.Key, |
|
|
|
|
|
|
|
LastModified: object.LastModified, |
|
|
|
|
|
|
|
Size: object.Size, |
|
|
|
|
|
|
|
} |
|
|
|
// TODO - This can get slower for large directories, we can
|
|
|
|
// TODO - This can get slower for large directories, we can
|
|
|
|
// perhaps extend the ListObjects XML to reply back
|
|
|
|
// perhaps extend the ListObjects XML to reply back
|
|
|
|
// ContentType as well.
|
|
|
|
// ContentType as well.
|
|
|
|
objectInfo, e := web.Client.StatObject(args.BucketName, object.Key) |
|
|
|
if !strings.HasSuffix(object.Key, "/") && object.Size > 0 { |
|
|
|
|
|
|
|
objectStatInfo, e := web.Client.StatObject(args.BucketName, object.Key) |
|
|
|
if e != nil { |
|
|
|
if e != nil { |
|
|
|
return e |
|
|
|
return e |
|
|
|
} |
|
|
|
} |
|
|
|
*reply = append(*reply, ObjectInfo{ |
|
|
|
objectInfo.ContentType = objectStatInfo.ContentType |
|
|
|
Key: objectInfo.Key, |
|
|
|
} |
|
|
|
LastModified: objectInfo.LastModified, |
|
|
|
*reply = append(*reply, objectInfo) |
|
|
|
Size: objectInfo.Size, |
|
|
|
|
|
|
|
ContentType: objectInfo.ContentType, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|