fix: add S3 addressing style option

Add a configurable S3 addressing style for remote backups while keeping path-style as the default for existing configurations. Use virtual-hosted-style to support providers such as Tencent COS buckets that reject path-style requests.
This commit is contained in:
shuaiplus
2026-06-15 16:53:28 +08:00
parent f6169b7610
commit a8183166ac
10 changed files with 70 additions and 6 deletions
+6
View File
@@ -16,6 +16,7 @@ import {
type BackupRuntimeState,
type BackupScheduleConfig,
type BackupSettings,
type S3BackupAddressingStyle,
type S3BackupDestination,
type WebDavBackupDestination,
createBackupRandomId,
@@ -35,6 +36,7 @@ export type {
BackupRuntimeState,
BackupScheduleConfig,
BackupSettings,
S3BackupAddressingStyle,
S3BackupDestination,
WebDavBackupDestination,
} from '../../shared/backup-schema';
@@ -109,6 +111,9 @@ function normalizeS3Destination(value: unknown, allowIncomplete = false): S3Back
const source = isPlainObject(value) ? value : {};
const endpoint = asTrimmedString(source.endpoint);
const bucket = asTrimmedString(source.bucket);
const addressingStyleRaw = asTrimmedString(source.addressingStyle);
const addressingStyle: S3BackupAddressingStyle =
addressingStyleRaw === 'virtual-hosted-style' ? 'virtual-hosted-style' : 'path-style';
const accessKeyId = asTrimmedString(source.accessKeyId);
const secretAccessKey = asTrimmedString(source.secretAccessKey);
const region = asTrimmedString(source.region) || 'auto';
@@ -131,6 +136,7 @@ function normalizeS3Destination(value: unknown, allowIncomplete = false): S3Back
return {
endpoint: endpoint ? endpoint.replace(/\/+$/, '') : '',
bucket,
addressingStyle,
region,
accessKeyId,
secretAccessKey,