Skip to content

Commit a659241

Browse files
committed
feat: enhance getPublicFileUrl to support MinIO endpoint for local development
1 parent ddd4cfe commit a659241

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/file/file.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ export class FileService {
168168

169169
private getPublicFileUrl(key: string, bucket: string) {
170170
const region = this.region;
171-
return `https://${bucket}.s3.${region}.backblazeb2.com/${key}`; // TODO: make possible to use custom domain
171+
if (this.S3_ENDPOINT.includes('localhost')) {
172+
// minio url
173+
return `${this.S3_ENDPOINT}/${bucket}/${key}`;
174+
} // production blackblaze url
175+
else return `https://${bucket}.s3.${region}.backblazeb2.com/${key}`; // TODO: make possible to use custom domain
172176
}
173177

174178
public async deleteSong(nbsFileUrl: string) {

0 commit comments

Comments
 (0)