mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
This commit is contained in:
parent
d42acd468a
commit
887d603e4b
1 changed files with 9 additions and 2 deletions
|
@ -91,8 +91,15 @@ public AmazonS3(AmazonS3Settings settings)
|
|||
|
||||
public override UploadResult Upload(Stream stream, string fileName)
|
||||
{
|
||||
bool forcePathStyle = Settings.UsePathStyle;
|
||||
|
||||
if (!forcePathStyle && Settings.Bucket.Contains("."))
|
||||
{
|
||||
forcePathStyle = true;
|
||||
}
|
||||
|
||||
string endpoint = URLHelpers.RemovePrefixes(Settings.Endpoint);
|
||||
string host = Settings.UsePathStyle ? endpoint : $"{Settings.Bucket}.{endpoint}";
|
||||
string host = forcePathStyle ? endpoint : $"{Settings.Bucket}.{endpoint}";
|
||||
string algorithm = "AWS4-HMAC-SHA256";
|
||||
string credentialDate = DateTime.UtcNow.ToString("yyyyMMdd", CultureInfo.InvariantCulture);
|
||||
string region = GetRegion();
|
||||
|
@ -118,7 +125,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
args.Add("X-Amz-SignedHeaders", signedHeaders);
|
||||
|
||||
string uploadPath = GetUploadPath(fileName);
|
||||
if (Settings.UsePathStyle) uploadPath = URLHelpers.CombineURL(Settings.Bucket, uploadPath);
|
||||
if (forcePathStyle) uploadPath = URLHelpers.CombineURL(Settings.Bucket, uploadPath);
|
||||
string canonicalURI = URLHelpers.AddSlash(uploadPath, SlashType.Prefix);
|
||||
canonicalURI = URLHelpers.URLPathEncode(canonicalURI);
|
||||
|
||||
|
|
Loading…
Reference in a new issue