From 2ebd7aca6c474147e5a1d1fb2a96b7d052a08a21 Mon Sep 17 00:00:00 2001 From: Vishwaraj Anand Date: Mon, 22 Apr 2024 13:14:41 +0000 Subject: [PATCH] fix: change copyoptions type (#2439) * fix: change copyoptions type * fix: added test * chore: address pr comments --- src/file.ts | 4 +++- test/file.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/file.ts b/src/file.ts index d7dc41a9f..e4438a7d8 100644 --- a/src/file.ts +++ b/src/file.ts @@ -361,7 +361,9 @@ export interface CopyOptions { contentType?: string; contentDisposition?: string; destinationKmsKeyName?: string; - metadata?: FileMetadata; + metadata?: { + [key: string]: string | boolean | number | null; + }; predefinedAcl?: string; token?: string; userProject?: string; diff --git a/test/file.ts b/test/file.ts index d0cc0c2ba..bd95ad26d 100644 --- a/test/file.ts +++ b/test/file.ts @@ -545,12 +545,17 @@ describe('File', () => { it('should accept an options object', done => { const newFile = new File(BUCKET, 'name'); + const METADATA = { + metadataKey: 'metadataValue', + }; const options = { option: true, + metadata: METADATA, }; file.request = (reqOpts: DecorateRequestOptions) => { assert.deepStrictEqual(reqOpts.json, options); + assert.strictEqual(reqOpts.json.metadata, METADATA); done(); };