mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: save deleteMarker properly, precision upto UnixNano() (#9843)
This commit is contained in:
parent
cbb7a09376
commit
087aaaf894
@ -950,6 +950,16 @@ func getOpts(ctx context.Context, r *http.Request, bucket, object string) (Objec
|
||||
return opts, nil
|
||||
}
|
||||
|
||||
func delOpts(ctx context.Context, r *http.Request, bucket, object string) (opts ObjectOptions, err error) {
|
||||
versioned := globalBucketVersioningSys.Enabled(bucket)
|
||||
opts, err = getOpts(ctx, r, bucket, object)
|
||||
if err != nil {
|
||||
return opts, err
|
||||
}
|
||||
opts.Versioned = versioned
|
||||
return opts, nil
|
||||
}
|
||||
|
||||
// get ObjectOptions for PUT calls from encryption headers and metadata
|
||||
func putOpts(ctx context.Context, r *http.Request, bucket, object string, metadata map[string]string) (opts ObjectOptions, err error) {
|
||||
versioned := globalBucketVersioningSys.Enabled(bucket)
|
||||
|
@ -2584,7 +2584,7 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
|
||||
}
|
||||
}
|
||||
|
||||
opts, err := getOpts(ctx, r, bucket, object)
|
||||
opts, err := delOpts(ctx, r, bucket, object)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r))
|
||||
return
|
||||
|
@ -231,7 +231,7 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
|
||||
Type: DeleteType,
|
||||
DeleteMarker: &xlMetaV2DeleteMarker{
|
||||
VersionID: uv,
|
||||
ModTime: fi.ModTime.Unix(),
|
||||
ModTime: fi.ModTime.UnixNano(),
|
||||
},
|
||||
})
|
||||
return nil
|
||||
@ -262,7 +262,7 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
|
||||
VersionID: uv,
|
||||
DataDir: dd,
|
||||
StatSize: fi.Size,
|
||||
StatModTime: fi.ModTime.Unix(),
|
||||
StatModTime: fi.ModTime.UnixNano(),
|
||||
ErasureAlgorithm: ReedSolomon,
|
||||
ErasureM: fi.Erasure.DataBlocks,
|
||||
ErasureN: fi.Erasure.ParityBlocks,
|
||||
@ -342,7 +342,7 @@ func (j xlMetaV2DeleteMarker) ToFileInfo(volume, path string) (FileInfo, error)
|
||||
fi := FileInfo{
|
||||
Volume: volume,
|
||||
Name: path,
|
||||
ModTime: time.Unix(j.ModTime, 0).UTC(),
|
||||
ModTime: time.Unix(0, j.ModTime).UTC(),
|
||||
VersionID: uuid.UUID(j.VersionID).String(),
|
||||
Deleted: true,
|
||||
}
|
||||
@ -360,7 +360,7 @@ func (j xlMetaV2Object) ToFileInfo(volume, path string) (FileInfo, error) {
|
||||
Volume: volume,
|
||||
Name: path,
|
||||
Size: j.StatSize,
|
||||
ModTime: time.Unix(j.StatModTime, 0).UTC(),
|
||||
ModTime: time.Unix(0, j.StatModTime).UTC(),
|
||||
VersionID: versionID,
|
||||
}
|
||||
fi.Parts = make([]ObjectPartInfo, len(j.PartNumbers))
|
||||
@ -536,9 +536,9 @@ func (z xlMetaV2) ToFileInfo(volume, path, versionID string) (FileInfo, error) {
|
||||
var modTime time.Time
|
||||
switch version.Type {
|
||||
case ObjectType:
|
||||
modTime = time.Unix(version.ObjectV2.StatModTime, 0)
|
||||
modTime = time.Unix(0, version.ObjectV2.StatModTime)
|
||||
case DeleteType:
|
||||
modTime = time.Unix(version.DeleteMarker.ModTime, 0)
|
||||
modTime = time.Unix(0, version.DeleteMarker.ModTime)
|
||||
case LegacyType:
|
||||
modTime = version.ObjectV1.Stat.ModTime
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user