Skip to content

Commit

Permalink
fix SignatureDoesNotMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
fysntian committed Jul 1, 2021
1 parent 404e495 commit 1c71374
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
24 changes: 12 additions & 12 deletions QCloudCSharpSDK/COSXML/Auth/IQCloudSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public string Source(Request request)

foreach (KeyValuePair<string, string> pair in sourceHeaders)
{
lowerKeySourceHeaders.Add(pair.Key.ToLower(), URLEncodeUtils.Encode(pair.Value));
lowerKeySourceHeaders.Add(pair.Key.ToLower(), pair.Value);
}

lowerKeySourceHeaders.Add("host", URLEncodeUtils.Encode(request.Host));
lowerKeySourceHeaders.Add("host", request.Host);

if (headerKeysToSign.Contains("content-length"))
{
Expand All @@ -157,11 +157,11 @@ public string Source(Request request)

if (contentLength > 0)
{
lowerKeySourceHeaders.Add("content-length", URLEncodeUtils.Encode(contentLength.ToString()));
lowerKeySourceHeaders.Add("content-length", contentLength.ToString());
}
}
catch (Exception)
{
catch (Exception)
{

}
}
Expand All @@ -172,7 +172,7 @@ public string Source(Request request)

foreach (KeyValuePair<string, string> pair in sourceParameters)
{
lowerKeySourceParameters.Add(pair.Key.ToLower(), URLEncodeUtils.Encode(pair.Value));
lowerKeySourceParameters.Add(pair.Key.ToLower(), pair.Value);
}

string path = URLEncodeUtils.Decode(request.Url.Path);
Expand Down Expand Up @@ -325,9 +325,9 @@ public string[] Calculate(List<string> keys, Dictionary<string, string> dict, bo
result = result.Substring(0, result.Length - 1);
keyResult = keyResult.Substring(0, keyResult.Length - 1);

return new string[]
{
result, keyResult
return new string[]
{
result, keyResult
};
}

Expand All @@ -349,7 +349,7 @@ public void LowerAndSort(List<string> list)
list[i] = list[i].ToLower();
}

list.Sort(delegate(string strA, string strB)
list.Sort(delegate (string strA, string strB)
{

return StringUtils.Compare(strA, strB, false);
Expand All @@ -361,8 +361,8 @@ public void LowerAndSort(List<string> list)

public sealed class CosXmlSigner : IQCloudSigner
{
public CosXmlSigner()
{
public CosXmlSigner()
{

}

Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/COSXML.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Deterministic>true</Deterministic>

<PackageId>Tencent.QCloud.Cos.Sdk</PackageId>
<Version>5.4.20.0</Version>
<Version>5.4.21.0</Version>
<Authors>Tencent</Authors>
<Company>Tencent</Company>
<description>Tencent Cloud COS(Cloud Object Service) .Net SDK</description>
Expand Down
2 changes: 1 addition & 1 deletion QCloudCSharpSDK/COSXML/Common/CosVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace COSXML.Common
{
public sealed class CosVersion
{
private static string SDKVersion = "5.4.19.0";
private static string SDKVersion = "5.4.21.0";

public static string GetUserAgent()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using COSXML.Common;
using COSXML.Model.Object;
using COSXML.CosException;
using COSXML.Utils;

namespace COSXML.Model.CI
{
Expand All @@ -21,7 +22,7 @@ public SensitiveContentRecognitionRequest(string bucket, string key, string type

this.method = CosRequestMethod.GET;
this.queryParameters.Add("ci-process", "sensitive-content-recognition");
this.queryParameters.Add("detect-type", type);
this.queryParameters.Add("detect-type", URLEncodeUtils.Encode(type));
}

}
Expand Down

0 comments on commit 1c71374

Please sign in to comment.