Invert forcePathStyle flag to be consistent with the default behavior

This commit is contained in:
Caelan Sayler
2025-03-23 16:35:38 +00:00
committed by Caelan
parent 7d65b9ef15
commit 9ed3205185
2 changed files with 8 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ public class S3DownloadOptions : RepositoryOptions, IObjectDownloadOptions
public string Prefix { get; set; }
public bool ForcePathStyle { get; set; }
public bool DisablePathStyle { get; set; }
}
public class S3UploadOptions : S3DownloadOptions, IObjectUploadOptions
@@ -100,8 +100,8 @@ public class S3Repository : ObjectRepository<S3DownloadOptions, S3UploadOptions,
bool disableSigning = false;
var config = new AmazonS3Config() {
ServiceURL = options.Endpoint,
ForcePathStyle = options.ForcePathStyle,
Timeout = TimeSpan.FromMinutes(options.Timeout)
ForcePathStyle = !options.DisablePathStyle, // default is ForcePathStyle = true, as it's more widely supported
Timeout = TimeSpan.FromMinutes(options.Timeout),
};
if (options.Endpoint != null) {

View File

@@ -16,7 +16,7 @@ public class S3BaseCommand : OutputCommand
public string Prefix { get; private set; }
public bool ForcePathStyle { get; private set; }
public bool DisablePathStyle { get; private set; }
public double Timeout { get; private set; }
@@ -42,7 +42,7 @@ public class S3BaseCommand : OutputCommand
region.Validators.Add(MustBeValidAwsRegion);
var endpoint = AddOption<Uri>((v) => Endpoint = v.ToAbsoluteOrNull(), "--endpoint")
.SetDescription("Custom service url (backblaze, digital ocean, etc).")
.SetDescription("Custom S3-compatible service url (backblaze, digital ocean, etc).")
.SetArgumentHelpName("URL")
.MustBeValidHttpUri();
@@ -58,10 +58,9 @@ public class S3BaseCommand : OutputCommand
.SetDescription("Prefix to the S3 url.")
.SetArgumentHelpName("PREFIX");
AddOption<bool>((v) => ForcePathStyle = v, "--forcePathStyle")
.SetDescription("Force a path-style endpoint to be used where the bucket name is part of the path.")
.SetArgumentHelpName("BOOL")
.SetDefault(true);
AddOption<bool>((v) => DisablePathStyle = v, "--disablePathStyle")
.SetDescription("Disable the default of path-style endpoint and use a subdomain endpoint instead.")
.SetArgumentHelpName("BOOL");
AddOption<double>((v) => Timeout = v, "--timeout")
.SetDescription("Network timeout in minutes.")