File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -108,11 +108,24 @@ export class MinioService implements OnModuleInit {
108108 } /${ bucketName } /${ objectName } `;
109109 }
110110
111- return await this . minioClient . presignedGetObject (
111+ const presignedUrl = await this . minioClient . presignedGetObject (
112112 bucketName ,
113113 objectName ,
114114 this . config . urlExpiryHours * 60 * 60 ,
115115 ) ;
116+
117+ // If external endpoint is configured, replace the internal endpoint with external endpoint in the URL
118+ if ( this . config . externalEndPoint ) {
119+ const urlObject = new URL ( presignedUrl ) ;
120+ urlObject . protocol = ( this . config . externalUseSSL ?? this . config . useSSL ) ? 'https:' : 'http:' ;
121+ urlObject . host = this . config . externalEndPoint ;
122+ if ( this . config . port ) {
123+ urlObject . port = this . config . port . toString ( ) ;
124+ }
125+ return urlObject . toString ( ) ;
126+ }
127+
128+ return presignedUrl ;
116129 }
117130
118131 async deleteFile ( bucketName : string , objectName : string ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments