From 6f7ef8711ae493764d688feabd6853c0f2b40c98 Mon Sep 17 00:00:00 2001 From: Ryan Russell Date: Thu, 15 Sep 2022 05:13:21 -0500 Subject: [PATCH] docs(s3api): readability improvements (#3696) Signed-off-by: Ryan Russell Signed-off-by: Ryan Russell --- weed/s3api/auth_signature_v2.go | 2 +- weed/s3api/auth_signature_v4.go | 6 +++--- weed/s3api/auto_signature_v4_test.go | 6 +++--- weed/s3api/chunked_reader_v4.go | 2 +- weed/s3api/policy/post-policy_test.go | 2 +- weed/s3api/policy/postpolicyform.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/weed/s3api/auth_signature_v2.go b/weed/s3api/auth_signature_v2.go index a30cec5e8..3fdc321b1 100644 --- a/weed/s3api/auth_signature_v2.go +++ b/weed/s3api/auth_signature_v2.go @@ -119,7 +119,7 @@ func validateV2AuthHeader(v2Auth string) (accessKey string, errCode s3err.ErrorC return "", s3err.ErrMissingFields } - // Then will be splitting on ":", this will seprate `AWSAccessKeyId` and `Signature` string. + // Then will be splitting on ":", this will separate `AWSAccessKeyId` and `Signature` string. keySignFields := strings.Split(strings.TrimSpace(authFields[1]), ":") if len(keySignFields) != 2 { return "", s3err.ErrMissingFields diff --git a/weed/s3api/auth_signature_v4.go b/weed/s3api/auth_signature_v4.go index bd78f471d..02a6bd4e0 100644 --- a/weed/s3api/auth_signature_v4.go +++ b/weed/s3api/auth_signature_v4.go @@ -225,7 +225,7 @@ func parseSignV4(v4Auth string) (sv signValues, aec s3err.ErrorCode) { signV4Values := signValues{} var err s3err.ErrorCode - // Save credentail values. + // Save credential values. signV4Values.Credential, err = parseCredentialHeader(authFields[0]) if err != s3err.ErrNone { return sv, err @@ -467,7 +467,7 @@ func contains(list []string, elem string) bool { return false } -// preSignValues data type represents structued form of AWS Signature V4 query string. +// preSignValues data type represents structured form of AWS Signature V4 query string. type preSignValues struct { signValues Date time.Time @@ -551,7 +551,7 @@ func parsePreSignV4(query url.Values) (psv preSignValues, aec s3err.ErrorCode) { return psv, err } - // Return structed form of signature query string. + // Return structured form of signature query string. return preSignV4Values, s3err.ErrNone } diff --git a/weed/s3api/auto_signature_v4_test.go b/weed/s3api/auto_signature_v4_test.go index 9daf7beba..db8bfd8ef 100644 --- a/weed/s3api/auto_signature_v4_test.go +++ b/weed/s3api/auto_signature_v4_test.go @@ -21,7 +21,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/s3api/s3err" ) -// TestIsRequestPresignedSignatureV4 - Test validates the logic for presign signature verision v4 detection. +// TestIsRequestPresignedSignatureV4 - Test validates the logic for presign signature version v4 detection. func TestIsRequestPresignedSignatureV4(t *testing.T) { testCases := []struct { inputQueryKey string @@ -138,7 +138,7 @@ func mustNewSignedRequest(method string, urlStr string, contentLength int64, bod req := mustNewRequest(method, urlStr, contentLength, body, t) cred := &Credential{"access_key_1", "secret_key_1"} if err := signRequestV4(req, cred.AccessKey, cred.SecretKey); err != nil { - t.Fatalf("Unable to inititalized new signed http request %s", err) + t.Fatalf("Unable to initialized new signed http request %s", err) } return req } @@ -149,7 +149,7 @@ func mustNewPresignedRequest(method string, urlStr string, contentLength int64, req := mustNewRequest(method, urlStr, contentLength, body, t) cred := &Credential{"access_key_1", "secret_key_1"} if err := preSignV4(req, cred.AccessKey, cred.SecretKey, int64(10*time.Minute.Seconds())); err != nil { - t.Fatalf("Unable to inititalized new signed http request %s", err) + t.Fatalf("Unable to initialized new signed http request %s", err) } return req } diff --git a/weed/s3api/chunked_reader_v4.go b/weed/s3api/chunked_reader_v4.go index c8c823907..8ba1bc479 100644 --- a/weed/s3api/chunked_reader_v4.go +++ b/weed/s3api/chunked_reader_v4.go @@ -135,7 +135,7 @@ func (iam *IdentityAccessManagement) calculateSeedSignature(r *http.Request) (cr return nil, "", "", time.Time{}, s3err.ErrSignatureDoesNotMatch } - // Return caculated signature. + // Return calculated signature. return cred, newSignature, region, date, s3err.ErrNone } diff --git a/weed/s3api/policy/post-policy_test.go b/weed/s3api/policy/post-policy_test.go index ce241b723..8b054023a 100644 --- a/weed/s3api/policy/post-policy_test.go +++ b/weed/s3api/policy/post-policy_test.go @@ -125,7 +125,7 @@ func newPostPolicyBytesV2(bucketName, objectKey string, expiration time.Time) [] // postPresignSignatureV4 - presigned signature for PostPolicy requests. func postPresignSignatureV4(policyBase64 string, t time.Time, secretAccessKey, location string) string { - // Get signining key. + // Get signing key. signingkey := getSigningKey(secretAccessKey, t, location) // Calculate signature. signature := getSignature(signingkey, policyBase64) diff --git a/weed/s3api/policy/postpolicyform.go b/weed/s3api/policy/postpolicyform.go index 3a6f3a882..011f782d7 100644 --- a/weed/s3api/policy/postpolicyform.go +++ b/weed/s3api/policy/postpolicyform.go @@ -203,7 +203,7 @@ func ParsePostPolicyForm(policy string) (ppf PostPolicyForm, e error) { return parsedPolicy, nil } -// checkPolicyCond returns a boolean to indicate if a condition is satisified according +// checkPolicyCond returns a boolean to indicate if a condition is satisfied according // to the passed operator func checkPolicyCond(op string, input1, input2 string) bool { switch op {