Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/w/7.7/bugfix/S3C-2726-removeSome…
Browse files Browse the repository at this point in the history
…DefaultAttributesFromObjectMD' into w/8.1/bugfix/S3C-2726-removeSomeDefaultAttributesFromObjectMD
  • Loading branch information
jonathan-gramain committed Apr 22, 2020
2 parents e553342 + 2b9ac57 commit d9ff2c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions lib/models/ObjectMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ class ObjectMD {
'key': '',
'location': null,
'azureInfo': undefined,
'isNull': '',
'nullVersionId': '',
'isDeleteMarker': '',
'versionId': undefined, // If no versionId, it should be undefined
// versionId, isNull, nullVersionId and isDeleteMarker
// should be undefined when not set explicitly
'isNull': undefined,
'nullVersionId': undefined,
'isDeleteMarker': undefined,
'versionId': undefined,
'tags': {},
'replicationInfo': {
status: '',
Expand Down Expand Up @@ -683,7 +685,7 @@ class ObjectMD {
* @return {boolean} Whether new version is null or not
*/
getIsNull() {
return this._data.isNull;
return this._data.isNull || false;
}

/**
Expand All @@ -700,7 +702,7 @@ class ObjectMD {
/**
* Get metadata nullVersionId value
*
* @return {string} The version id of the null version
* @return {string|undefined} The version id of the null version
*/
getNullVersionId() {
return this._data.nullVersionId;
Expand All @@ -723,7 +725,7 @@ class ObjectMD {
* @return {boolean} Whether object is a delete marker
*/
getIsDeleteMarker() {
return this._data.isDeleteMarker;
return this._data.isDeleteMarker || false;
}

/**
Expand Down Expand Up @@ -753,7 +755,7 @@ class ObjectMD {
/**
* Get metadata versionId value
*
* @return {string} The object versionId
* @return {string|undefined} The object versionId
*/
getVersionId() {
return this._data.versionId;
Expand All @@ -763,7 +765,7 @@ class ObjectMD {
* Get metadata versionId value in encoded form (the one visible
* to the S3 API user)
*
* @return {string} The encoded object versionId
* @return {string|undefined} The encoded object versionId
*/
getEncodedVersionId() {
if (this.getVersionId()) {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/models/ObjectMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ describe('ObjectMD class setters/getters', () => {
['Key', 'key'],
['Location', null, []],
['Location', ['location1']],
['IsNull', null, ''],
['IsNull', null, false],
['IsNull', true],
['NullVersionId', null, ''],
['NullVersionId', null, undefined],
['NullVersionId', '111111'],
['IsDeleteMarker', null, ''],
['IsDeleteMarker', null, false],
['IsDeleteMarker', true],
['VersionId', null, undefined],
['VersionId', '111111'],
Expand Down

0 comments on commit d9ff2c2

Please sign in to comment.