1- import { IStorageProvider , StorageConfig } from '../../interfaces/index.js' ;
1+ import { IStorageProvider , StorageConfig , UrlOptions } from '../../interfaces/index.js' ;
22import { Storage } from '@google-cloud/storage' ;
33import { ConduitGrpcSdk } from '@conduitplatform/grpc-sdk' ;
44import { SIGNED_URL_EXPIRY_DATE } from '../../constants/expiry.js' ;
5+ import { constructDispositionHeader } from '../../utils/index.js' ;
56
67/**
78 * WARNING: DO NOT USE THIS, IT NEEDS A REWRITE
@@ -103,13 +104,14 @@ export class GoogleCloudStorage implements IStorageProvider {
103104 } ) ;
104105 }
105106
106- async getSignedUrl ( fileName : string ) : Promise < any | Error > {
107+ async getSignedUrl ( fileName : string , options ?: UrlOptions ) : Promise < any | Error > {
107108 this . _storage
108109 . bucket ( this . _activeBucket )
109110 . file ( fileName )
110111 . getSignedUrl ( {
111112 action : 'read' ,
112113 expires : SIGNED_URL_EXPIRY_DATE ( ) ,
114+ responseDisposition : constructDispositionHeader ( fileName , options ) ,
113115 } )
114116 . then ( ( r : any ) => {
115117 if ( r . data && r . data [ 0 ] ) {
@@ -120,8 +122,7 @@ export class GoogleCloudStorage implements IStorageProvider {
120122 }
121123
122124 async getPublicUrl ( fileName : string ) : Promise < any | Error > {
123- await this . _storage . bucket ( this . _activeBucket ) . file ( fileName ) . isPublic ( ) ;
124- return this . _storage . bucket ( this . _activeBucket ) . file ( fileName ) . baseUrl ;
125+ return this . _storage . bucket ( this . _activeBucket ) . file ( fileName ) . publicUrl ( ) ;
125126 }
126127
127128 async store (
0 commit comments