fix: download url

This commit is contained in:
BennyKok
2023-12-29 16:23:45 +08:00
parent d54ed35755
commit 62f8ba2c70
4 changed files with 45 additions and 33 deletions
+2 -1
View File
@@ -7,9 +7,10 @@ export function replaceCDNUrl(url: string) {
);
// When using digital ocean, we need to use the bucket name in the URL
} else if (process.env.SPACES_CDN_FORCE_PATH_STYLE === "false") {
const cdnUrl = new URL(process.env.SPACES_ENDPOINT_CDN!);
url = url.replace(
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}`,
`${process.env.SPACES_BUCKET}.${process.env.SPACES_ENDPOINT_CDN}}`
`${cdnUrl.protocol}//${process.env.SPACES_BUCKET}.${cdnUrl.host}`
);
} else {
url = url.replace(