Compare commits

..

No commits in common. "d1d140997a56afe3daefc87b6dda43bc77c345f6" and "a99a6d9d971ec57500b396616cfadf50df1f725a" have entirely different histories.

4 changed files with 3 additions and 54 deletions

View File

@ -1,6 +1,5 @@
import * as constants from '../constants'; import * as constants from '../constants';
import * as VersionIDUtils from '../versioning/VersionID'; import * as VersionIDUtils from '../versioning/VersionID';
import { VersioningConstants } from '../versioning/constants';
import ObjectMDLocation, { import ObjectMDLocation, {
ObjectMDLocationData, ObjectMDLocationData,
Location, Location,
@ -798,9 +797,6 @@ export default class ObjectMD {
* @return The object versionId * @return The object versionId
*/ */
getVersionId() { getVersionId() {
if (this.getIsNull()) {
return VersioningConstants.ExternalNullVersionId;
}
return this._data.versionId; return this._data.versionId;
} }
@ -808,16 +804,13 @@ export default class ObjectMD {
* Get metadata versionId value in encoded form (the one visible * Get metadata versionId value in encoded form (the one visible
* to the S3 API user) * to the S3 API user)
* *
* @return {undefined|string} The encoded object versionId * @return The encoded object versionId
*/ */
getEncodedVersionId() { getEncodedVersionId() {
const versionId = this.getVersionId(); const versionId = this.getVersionId();
if (versionId === VersioningConstants.ExternalNullVersionId) { if (versionId) {
return versionId;
} else if (versionId) {
return VersionIDUtils.encode(versionId); return VersionIDUtils.encode(versionId);
} }
return undefined;
} }
/** /**

View File

@ -15,5 +15,4 @@ export const VersioningConstants = {
v1mig: 'v1mig', v1mig: 'v1mig',
v1: 'v1', v1: 'v1',
}, },
ExternalNullVersionId: 'null',
}; };

View File

@ -3,7 +3,7 @@
"engines": { "engines": {
"node": ">=16" "node": ">=16"
}, },
"version": "7.70.14-1", "version": "7.70.14",
"description": "Common utilities for the S3 project components", "description": "Common utilities for the S3 project components",
"main": "build/index.js", "main": "build/index.js",
"repository": { "repository": {

View File

@ -1,8 +1,6 @@
const assert = require('assert'); const assert = require('assert');
const ObjectMD = require('../../../lib/models/ObjectMD').default; const ObjectMD = require('../../../lib/models/ObjectMD').default;
const constants = require('../../../lib/constants'); const constants = require('../../../lib/constants');
const ExternalNullVersionId = require('../../../lib/versioning/constants')
.VersioningConstants.ExternalNullVersionId;
const retainDate = new Date(); const retainDate = new Date();
retainDate.setDate(retainDate.getDate() + 1); retainDate.setDate(retainDate.getDate() + 1);
@ -585,44 +583,3 @@ describe('ObjectMD::getReducedLocations', () => {
]); ]);
}); });
}); });
describe('ObjectMD::getVersionId', () => {
let objMd = null;
const versionId = '98451712418844999999RG001 22019.0';
beforeEach(() => {
objMd = new ObjectMD();
});
it('should return undefined when object is non versioned', () => {
assert.strictEqual(objMd.getVersionId(), undefined);
});
it('should return versionId when object versioned', () => {
objMd.setVersionId(versionId);
assert.strictEqual(objMd.getVersionId(), versionId);
});
it('should return "null" when object is in versioning suspended mode', () => {
objMd.setVersionId(versionId);
objMd.setIsNull(true);
assert.strictEqual(objMd.getVersionId(), ExternalNullVersionId);
});
});
describe('ObjectMD::getEncodedVersionId', () => {
let objMd = null;
const versionId = '98451712418844999999RG001 22019.0';
const encodedVersionId = '39383435313731323431383834343939393939395247303031202032323031392e30';
beforeEach(() => {
objMd = new ObjectMD();
});
it('should return undefined when object is non versioned', () => {
assert.strictEqual(objMd.getEncodedVersionId(), undefined);
});
it('should return versionId when object versioned', () => {
objMd.setVersionId(versionId);
assert.strictEqual(objMd.getEncodedVersionId(), encodedVersionId);
});
it('should return "null" when object is in versioning suspended mode', () => {
objMd.setVersionId(versionId);
objMd.setIsNull(true);
assert.strictEqual(objMd.getEncodedVersionId(), ExternalNullVersionId);
});
});