File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3857,10 +3857,6 @@ class File extends ServiceObject<File, FileMetadata> {
3857
3857
options
3858
3858
) ;
3859
3859
3860
- if ( metadata . retention !== undefined ) {
3861
- options . overrideUnlockedRetention = true ;
3862
- }
3863
-
3864
3860
super
3865
3861
. setMetadata ( metadata , options )
3866
3862
. then ( resp => cb ! ( null , ...resp ) )
Original file line number Diff line number Diff line change @@ -1648,7 +1648,10 @@ describe('storage', function () {
1648
1648
1649
1649
it ( 'should disable object retention on the file' , async ( ) => {
1650
1650
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
+ ) ;
1652
1655
assert . strictEqual ( metadata . retention , undefined ) ;
1653
1656
} ) ;
1654
1657
} ) ;
Original file line number Diff line number Diff line change @@ -4589,16 +4589,19 @@ describe('File', () => {
4589
4589
} ) ;
4590
4590
4591
4591
describe ( 'setMetadata' , ( ) => {
4592
- it ( 'should set query parameter overrideUnlockedRetention ' , done => {
4592
+ it ( 'should accept overrideUnlockedRetention option and set query parameter' , done => {
4593
4593
const newFile = new File ( BUCKET , 'new-file' ) ;
4594
4594
4595
4595
newFile . parent . request = ( reqOpts : DecorateRequestOptions ) => {
4596
- console . log ( reqOpts . qs ) ;
4597
4596
assert . strictEqual ( reqOpts . qs . overrideUnlockedRetention , true ) ;
4598
4597
done ( ) ;
4599
4598
} ;
4600
4599
4601
- newFile . setMetadata ( { retention : null } , assert . ifError ) ;
4600
+ newFile . setMetadata (
4601
+ { retention : null } ,
4602
+ { overrideUnlockedRetention : true } ,
4603
+ assert . ifError
4604
+ ) ;
4602
4605
} ) ;
4603
4606
} ) ;
4604
4607
You can’t perform that action at this time.
0 commit comments