Added fix to auto-set --s3-ext-forcepathstyle if the target is not an Amazon S3 provider

This commit is contained in:
Kenneth Skovhede
2017-08-29 10:35:41 +02:00
parent 8bbeb54e48
commit e39ec4ddf5
+6 -1
View File
@@ -257,7 +257,12 @@ namespace Duplicati.Library.Backend
if (m_prefix.Length != 0 && !m_prefix.EndsWith("/"))
m_prefix += "/";
m_wrapper = new S3Wrapper(awsID, awsKey, locationConstraint, host, storageClass, useSSL, options);
// Auto-disable dns lookup for non AWS configurations
var hasForcePathStyle = options.ContainsKey("s3-ext-forcepathstyle");
if (!hasForcePathStyle && !DEFAULT_S3_LOCATION_BASED_HOSTS.Any(x => string.Equals(x.Value, host, StringComparison.OrdinalIgnoreCase)) && !string.Equals(host, "s3.amazonaws.com", StringComparison.OrdinalIgnoreCase))
options["s3-ext-forcepathstyle"] = "true";
m_wrapper = new S3Wrapper(awsID, awsKey, locationConstraint, host, storageClass, useSSL, options);
}
public static bool IsValidHostname(string bucketname)