mirror of
https://github.com/ShareX/ShareX.git
synced 2024-08-15 10:12:12 +12:00
Merge pull request #119 from alanedwardes/master
The S3 object name is no longer generated twice, previously resulting in...
This commit is contained in:
commit
f449a9a414
3 changed files with 7 additions and 6 deletions
|
@ -59,7 +59,7 @@ public S3PolicyCondition(string key, string value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPolicyDocument(string fileName)
|
private string GetPolicyDocument(string fileName, string objectKey)
|
||||||
{
|
{
|
||||||
var policyDocument = new
|
var policyDocument = new
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ private string GetPolicyDocument(string fileName)
|
||||||
new S3PolicyCondition("acl", "public-read"),
|
new S3PolicyCondition("acl", "public-read"),
|
||||||
new S3PolicyCondition("bucket", S3Settings.Bucket),
|
new S3PolicyCondition("bucket", S3Settings.Bucket),
|
||||||
new S3PolicyCondition("Content-Type", Helpers.GetMimeType(fileName)),
|
new S3PolicyCondition("Content-Type", Helpers.GetMimeType(fileName)),
|
||||||
new S3PolicyCondition("key", GetObjectKey(fileName)),
|
new S3PolicyCondition("key", objectKey),
|
||||||
new S3PolicyCondition("x-amz-storage-class", GetObjectStorageClass())
|
new S3PolicyCondition("x-amz-storage-class", GetObjectStorageClass())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ private string GetObjectURL(string objectName)
|
||||||
|
|
||||||
private Dictionary<string, string> GetParameters(string fileName, string objectKey)
|
private Dictionary<string, string> GetParameters(string fileName, string objectKey)
|
||||||
{
|
{
|
||||||
var policyDocument = GetPolicyDocument(fileName);
|
var policyDocument = GetPolicyDocument(fileName, objectKey);
|
||||||
var policyBytes = Encoding.ASCII.GetBytes(policyDocument);
|
var policyBytes = Encoding.ASCII.GetBytes(policyDocument);
|
||||||
var signature = CreateSignature(S3Settings.SecretAccessKey, policyBytes);
|
var signature = CreateSignature(S3Settings.SecretAccessKey, policyBytes);
|
||||||
|
|
||||||
|
|
5
UploadersLib/GUI/UploadersConfigForm.Designer.cs
generated
5
UploadersLib/GUI/UploadersConfigForm.Designer.cs
generated
|
@ -1952,7 +1952,6 @@ private void InitializeComponent()
|
||||||
this.txtAmazonS3ObjectPrefix.Name = "txtAmazonS3ObjectPrefix";
|
this.txtAmazonS3ObjectPrefix.Name = "txtAmazonS3ObjectPrefix";
|
||||||
this.txtAmazonS3ObjectPrefix.Size = new System.Drawing.Size(348, 20);
|
this.txtAmazonS3ObjectPrefix.Size = new System.Drawing.Size(348, 20);
|
||||||
this.txtAmazonS3ObjectPrefix.TabIndex = 14;
|
this.txtAmazonS3ObjectPrefix.TabIndex = 14;
|
||||||
this.ttHelpTip.SetToolTip(this.txtAmazonS3ObjectPrefix, "The name to prefix objects with when storing them.");
|
|
||||||
this.txtAmazonS3ObjectPrefix.TextChanged += new System.EventHandler(this.txtAmazonS3ObjectPrefix_TextChanged);
|
this.txtAmazonS3ObjectPrefix.TextChanged += new System.EventHandler(this.txtAmazonS3ObjectPrefix_TextChanged);
|
||||||
//
|
//
|
||||||
// lblAmazonS3ObjectPrefix
|
// lblAmazonS3ObjectPrefix
|
||||||
|
@ -1960,9 +1959,9 @@ private void InitializeComponent()
|
||||||
this.lblAmazonS3ObjectPrefix.AutoSize = true;
|
this.lblAmazonS3ObjectPrefix.AutoSize = true;
|
||||||
this.lblAmazonS3ObjectPrefix.Location = new System.Drawing.Point(26, 135);
|
this.lblAmazonS3ObjectPrefix.Location = new System.Drawing.Point(26, 135);
|
||||||
this.lblAmazonS3ObjectPrefix.Name = "lblAmazonS3ObjectPrefix";
|
this.lblAmazonS3ObjectPrefix.Name = "lblAmazonS3ObjectPrefix";
|
||||||
this.lblAmazonS3ObjectPrefix.Size = new System.Drawing.Size(69, 13);
|
this.lblAmazonS3ObjectPrefix.Size = new System.Drawing.Size(68, 13);
|
||||||
this.lblAmazonS3ObjectPrefix.TabIndex = 13;
|
this.lblAmazonS3ObjectPrefix.TabIndex = 13;
|
||||||
this.lblAmazonS3ObjectPrefix.Text = "Object prefix:";
|
this.lblAmazonS3ObjectPrefix.Text = "Upload path:";
|
||||||
//
|
//
|
||||||
// cbAmazonS3UseRRS
|
// cbAmazonS3UseRRS
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,6 +48,8 @@ public UploadersConfigForm(UploadersConfig uploadersConfig)
|
||||||
CreateUserControlEvents();
|
CreateUserControlEvents();
|
||||||
LoadSettings(uploadersConfig);
|
LoadSettings(uploadersConfig);
|
||||||
Text = "ShareX - Outputs Configuration" + (string.IsNullOrEmpty(uploadersConfig.FilePath) ? string.Empty : " - " + uploadersConfig.FilePath);
|
Text = "ShareX - Outputs Configuration" + (string.IsNullOrEmpty(uploadersConfig.FilePath) ? string.Empty : " - " + uploadersConfig.FilePath);
|
||||||
|
|
||||||
|
NameParser.CreateCodesMenu(this.txtAmazonS3ObjectPrefix, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UploadersConfigForm_FormClosed(object sender, FormClosedEventArgs e)
|
private void UploadersConfigForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue