fixed `getS3url` to work with `s3usePathStyle`

pull/29/head
tycrek 3 years ago
parent cec58fc5b7
commit 217b78f52f
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -12,7 +12,7 @@ const { HTTP, HTTPS, KILOBYTES } = require('./MagicNumbers.json');
// Catch config.json not existing when running setup script
try {
var { useSsl, port, domain, isProxied, diskFilePath, saveWithDate, s3bucket, s3endpoint } = require('./config.json'); // skipcq: JS-0239, JS-0102
var { useSsl, port, domain, isProxied, diskFilePath, saveWithDate, s3bucket, s3endpoint, s3usePathStyle } = require('./config.json'); // skipcq: JS-0239, JS-0102
} catch (ex) {
if (ex.code !== 'MODULE_NOT_FOUND') console.error(ex);
}
@ -26,7 +26,7 @@ function getTrueDomain(d = domain) {
}
function getS3url(s3key, ext) {
return `https://${s3bucket}.${s3endpoint}/${s3key}${ext}`;
return `https://${s3usePathStyle ? `${s3endpoint}/${s3bucket}` : `${s3bucket}.${s3endpoint}`}/${s3key}${ext}`;
}
function getDirectUrl(resourceId) {

Loading…
Cancel
Save