mirror of
https://github.com/minio/minio.git
synced 2025-03-03 07:10:07 -05:00
fs: Use mimedb now.
This commit is contained in:
parent
35dcccb4cd
commit
6f80380497
@ -38,8 +38,8 @@ import (
|
|||||||
"github.com/minio/minio-xl/pkg/crypto/sha256"
|
"github.com/minio/minio-xl/pkg/crypto/sha256"
|
||||||
"github.com/minio/minio-xl/pkg/crypto/sha512"
|
"github.com/minio/minio-xl/pkg/crypto/sha512"
|
||||||
"github.com/minio/minio-xl/pkg/probe"
|
"github.com/minio/minio-xl/pkg/probe"
|
||||||
"github.com/minio/minio/pkg/contentdb"
|
|
||||||
"github.com/minio/minio/pkg/disk"
|
"github.com/minio/minio/pkg/disk"
|
||||||
|
"github.com/minio/minio/pkg/mimedb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// isValidUploadID - is upload id.
|
// isValidUploadID - is upload id.
|
||||||
@ -507,7 +507,10 @@ func (fs Filesystem) CompleteMultipartUpload(bucket, object, uploadID string, da
|
|||||||
}
|
}
|
||||||
contentType := "application/octet-stream"
|
contentType := "application/octet-stream"
|
||||||
if objectExt := filepath.Ext(objectPath); objectExt != "" {
|
if objectExt := filepath.Ext(objectPath); objectExt != "" {
|
||||||
contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
|
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
|
||||||
|
if ok {
|
||||||
|
contentType = content.ContentType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
newObject := ObjectMetadata{
|
newObject := ObjectMetadata{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
|
@ -31,9 +31,9 @@ import (
|
|||||||
"github.com/minio/minio-xl/pkg/atomic"
|
"github.com/minio/minio-xl/pkg/atomic"
|
||||||
"github.com/minio/minio-xl/pkg/crypto/sha256"
|
"github.com/minio/minio-xl/pkg/crypto/sha256"
|
||||||
"github.com/minio/minio-xl/pkg/probe"
|
"github.com/minio/minio-xl/pkg/probe"
|
||||||
"github.com/minio/minio/pkg/contentdb"
|
|
||||||
"github.com/minio/minio/pkg/disk"
|
"github.com/minio/minio/pkg/disk"
|
||||||
"github.com/minio/minio/pkg/ioutils"
|
"github.com/minio/minio/pkg/ioutils"
|
||||||
|
"github.com/minio/minio/pkg/mimedb"
|
||||||
)
|
)
|
||||||
|
|
||||||
/// Object Operations
|
/// Object Operations
|
||||||
@ -155,8 +155,12 @@ func getMetadata(rootPath, bucket, object string) (ObjectMetadata, *probe.Error)
|
|||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
object = sanitizeWindowsPath(object)
|
object = sanitizeWindowsPath(object)
|
||||||
}
|
}
|
||||||
|
|
||||||
if objectExt := filepath.Ext(object); objectExt != "" {
|
if objectExt := filepath.Ext(object); objectExt != "" {
|
||||||
contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
|
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
|
||||||
|
if ok {
|
||||||
|
contentType = content.ContentType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
metadata := ObjectMetadata{
|
metadata := ObjectMetadata{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
@ -293,7 +297,10 @@ func (fs Filesystem) CreateObject(bucket, object, expectedMD5Sum string, size in
|
|||||||
}
|
}
|
||||||
contentType := "application/octet-stream"
|
contentType := "application/octet-stream"
|
||||||
if objectExt := filepath.Ext(objectPath); objectExt != "" {
|
if objectExt := filepath.Ext(objectPath); objectExt != "" {
|
||||||
contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
|
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
|
||||||
|
if ok {
|
||||||
|
contentType = content.ContentType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
newObject := ObjectMetadata{
|
newObject := ObjectMetadata{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio-xl/pkg/probe"
|
"github.com/minio/minio-xl/pkg/probe"
|
||||||
"github.com/minio/minio/pkg/contentdb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Filesystem - local variables
|
// Filesystem - local variables
|
||||||
@ -81,11 +80,6 @@ func New(rootPath string, minFreeDisk int64, maxBuckets int) (Filesystem, *probe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize contentdb.
|
|
||||||
if e := contentdb.Init(); e != nil {
|
|
||||||
return Filesystem{}, probe.NewError(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
var buckets *Buckets
|
var buckets *Buckets
|
||||||
buckets, err = loadBucketsMetadata()
|
buckets, err = loadBucketsMetadata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user