File tree Expand file tree Collapse file tree
tests/functional/aws-node-sdk/test/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,6 +175,13 @@ const services = {
175175 }
176176 if ( versionId || versionId === '' ) {
177177 options . versionId = versionId ;
178+ // Without nullVersionCompatMode (for metadata backend)
179+ // a null version object key doesn't have versionId.
180+ // Override md options.versionId to 'null' to avoid creating a new version object.
181+ // At the end of processing to avoid impacting versionId in MD payload
182+ if ( headers && headers [ 'x-scal-s3-version-id' ] === 'null' && ! config . nullVersionCompatMode ) {
183+ options . versionId = 'null' ;
184+ }
178185 }
179186 if ( needOplogUpdate ) {
180187 options . needOplogUpdate = true ;
Original file line number Diff line number Diff line change @@ -7,12 +7,19 @@ const log = new DummyRequestLogger();
77const nonVersionedObjId =
88 versionIdUtils . getInfVid ( config . replicationGroupId ) ;
99
10+ const nullKeySupported = [ 'file' , 'scality' ] . includes ( config . backends . metadata ) ;
11+ // With null version compat mode the null key should look like
12+ // 'object1putversion\u000099999999999999999999RG001 '
13+ // Without it for BucketFile backends it looks like
14+ // 'object1putversion\x00'
15+ const nullKey = nullKeySupported && ! config . nullVersionCompatMode ;
16+
1017function decodeVersionId ( versionId ) {
1118 let decodedVersionId ;
1219 if ( versionId ) {
1320 if ( versionId === 'null' ) {
1421 // At least file backend handles both
15- decodedVersionId = config . enableNullVersionCompatMode ? nonVersionedObjId : 'null' ;
22+ decodedVersionId = nullKey ? 'null' : nonVersionedObjId ;
1623 } else {
1724 decodedVersionId = versionIdUtils . decode ( versionId ) ;
1825 }
You can’t perform that action at this time.
0 commit comments