|
|
@ -173,14 +173,14 @@ func (fs Filesystem) NewMultipartUpload(bucket, object string) (string, *probe.E |
|
|
|
objectPath := filepath.Join(bucketPath, object) |
|
|
|
objectPath := filepath.Join(bucketPath, object) |
|
|
|
objectDir := filepath.Dir(objectPath) |
|
|
|
objectDir := filepath.Dir(objectPath) |
|
|
|
if _, e := os.Stat(objectDir); e != nil { |
|
|
|
if _, e := os.Stat(objectDir); e != nil { |
|
|
|
if os.IsNotExist(e) { |
|
|
|
if !os.IsNotExist(e) { |
|
|
|
|
|
|
|
return "", probe.NewError(e) |
|
|
|
|
|
|
|
} |
|
|
|
e = os.MkdirAll(objectDir, 0700) |
|
|
|
e = os.MkdirAll(objectDir, 0700) |
|
|
|
if e != nil { |
|
|
|
if e != nil { |
|
|
|
return "", probe.NewError(e) |
|
|
|
return "", probe.NewError(e) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return "", probe.NewError(e) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
id := []byte(strconv.FormatInt(rand.Int63(), 10) + bucket + object + time.Now().String()) |
|
|
|
id := []byte(strconv.FormatInt(rand.Int63(), 10) + bucket + object + time.Now().String()) |
|
|
|
uploadIDSum := sha512.Sum512(id) |
|
|
|
uploadIDSum := sha512.Sum512(id) |
|
|
@ -192,7 +192,7 @@ func (fs Filesystem) NewMultipartUpload(bucket, object string) (string, *probe.E |
|
|
|
} |
|
|
|
} |
|
|
|
defer multiPartfile.Close() |
|
|
|
defer multiPartfile.Close() |
|
|
|
|
|
|
|
|
|
|
|
mpartSession := new(MultipartSession) |
|
|
|
mpartSession := &MultipartSession{} |
|
|
|
mpartSession.TotalParts = 0 |
|
|
|
mpartSession.TotalParts = 0 |
|
|
|
mpartSession.UploadID = uploadID |
|
|
|
mpartSession.UploadID = uploadID |
|
|
|
mpartSession.Initiated = time.Now().UTC() |
|
|
|
mpartSession.Initiated = time.Now().UTC() |
|
|
|