mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
contentType: Reply back proper contentTypes based on the file extension.
Currently the server would set 'application/octet-stream' for all objects, set this value based on the file extension transparently. This is useful in case of minio browser to facilitate displaying proper icons for the different mime data types.
This commit is contained in:
@@ -95,10 +95,18 @@ func (web *WebAPI) ListObjects(r *http.Request, args *ListObjectsArgs, reply *[]
|
||||
if object.Err != nil {
|
||||
return object.Err
|
||||
}
|
||||
// TODO - This can get slower for large directories, we can
|
||||
// perhaps extend the ListObjects XML to reply back
|
||||
// ContentType as well.
|
||||
objectInfo, e := web.Client.StatObject(args.BucketName, object.Key)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
*reply = append(*reply, ObjectInfo{
|
||||
Key: object.Key,
|
||||
LastModified: object.LastModified,
|
||||
Size: object.Size,
|
||||
Key: objectInfo.Key,
|
||||
LastModified: objectInfo.LastModified,
|
||||
Size: objectInfo.Size,
|
||||
ContentType: objectInfo.ContentType,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user