mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
[feat] Preserve version supplied by client (#9854)
Just like GET/DELETE APIs it is possible to preserve client supplied versionId's, of course the versionIds have to be uuid, if an existing versionId is found it is overwritten if no object locking policies are found. - PUT /bucketname/objectname?versionId=<id> - POST /bucketname/objectname?uploads=&versionId=<id> - PUT /bucketname/objectname?verisonId=<id> (with x-amz-copy-source)
This commit is contained in:
@@ -237,14 +237,16 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var uv uuid.UUID
|
||||
var err error
|
||||
// null version Id means empty version Id.
|
||||
if fi.VersionID == nullVersionID {
|
||||
fi.VersionID = ""
|
||||
if fi.VersionID == "" {
|
||||
// this means versioning is not yet
|
||||
// enabled i.e all versions are basically
|
||||
// default value i.e "null"
|
||||
fi.VersionID = nullVersionID
|
||||
}
|
||||
|
||||
if fi.VersionID != "" {
|
||||
var uv uuid.UUID
|
||||
var err error
|
||||
if fi.VersionID != "" && fi.VersionID != nullVersionID {
|
||||
uv, err = uuid.Parse(fi.VersionID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user