diff --git a/package-lock.json b/package-lock.json index 9471b85..8b1614f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tweedegolf/storage-abstraction", - "version": "2.1.2", + "version": "2.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tweedegolf/storage-abstraction", - "version": "2.1.2", + "version": "2.1.3", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.550.0", diff --git a/src/AdapterGoogleCloud.ts b/src/AdapterGoogleCloud.ts index 625278d..62f5885 100644 --- a/src/AdapterGoogleCloud.ts +++ b/src/AdapterGoogleCloud.ts @@ -58,10 +58,20 @@ export class AdapterGoogleCloud extends AbstractAdapter { // protected, called by methods of public API via AbstractAdapter - protected async _getFileAsURL(bucketName: string, fileName: string): Promise { + protected async _getFileAsURL(bucketName: string, fileName: string, options: Options): Promise { try { const file = this._client.bucket(bucketName).file(fileName); - return { value: file.publicUrl(), error: null }; + if(options.signed) { + return { + value: await file.getSignedUrl({ + action: 'read', + expires: options.expiresIn || 1000 * 60 * 60 * 24, + })[0], + error: null + } + } else { + return { value: file.publicUrl(), error: null }; + } } catch (e) { return { value: null, error: e.message }; }