Skip to content

Commit c781bdc

Browse files
authored
fix: do not automatically set overrideUnlockedRetention (#2421)
1 parent 11ebe2b commit c781bdc

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/file.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3857,10 +3857,6 @@ class File extends ServiceObject<File, FileMetadata> {
38573857
options
38583858
);
38593859

3860-
if (metadata.retention !== undefined) {
3861-
options.overrideUnlockedRetention = true;
3862-
}
3863-
38643860
super
38653861
.setMetadata(metadata, options)
38663862
.then(resp => cb!(null, ...resp))

system-test/storage.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,10 @@ describe('storage', function () {
16481648

16491649
it('should disable object retention on the file', async () => {
16501650
const file = new File(objectRetentionBucket, fileName);
1651-
const [metadata] = await file.setMetadata({retention: null});
1651+
const [metadata] = await file.setMetadata(
1652+
{retention: null},
1653+
{overrideUnlockedRetention: true}
1654+
);
16521655
assert.strictEqual(metadata.retention, undefined);
16531656
});
16541657
});

test/file.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,16 +4589,19 @@ describe('File', () => {
45894589
});
45904590

45914591
describe('setMetadata', () => {
4592-
it('should set query parameter overrideUnlockedRetention', done => {
4592+
it('should accept overrideUnlockedRetention option and set query parameter', done => {
45934593
const newFile = new File(BUCKET, 'new-file');
45944594

45954595
newFile.parent.request = (reqOpts: DecorateRequestOptions) => {
4596-
console.log(reqOpts.qs);
45974596
assert.strictEqual(reqOpts.qs.overrideUnlockedRetention, true);
45984597
done();
45994598
};
46004599

4601-
newFile.setMetadata({retention: null}, assert.ifError);
4600+
newFile.setMetadata(
4601+
{retention: null},
4602+
{overrideUnlockedRetention: true},
4603+
assert.ifError
4604+
);
46024605
});
46034606
});
46044607

0 commit comments

Comments
 (0)