mirror of
https://github.com/versity/versitygw.git
synced 2026-06-09 04:22:34 +00:00
Merge pull request #2048 from versity/ben/misspell
chore: fix spellings and unused function args
This commit is contained in:
@@ -64,7 +64,7 @@ func (bp *BucketPolicy) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
if tmp.Version == nil {
|
||||
// bucket policy version should defualt to '2008-10-17'
|
||||
// bucket policy version should default to '2008-10-17'
|
||||
bp.Version = PolicyVersion2008
|
||||
} else {
|
||||
bp.Version = *tmp.Version
|
||||
|
||||
@@ -93,8 +93,8 @@ var (
|
||||
|
||||
// ParseObjectRange parses input range header and returns startoffset, length, isValid
|
||||
// and error. If no endoffset specified, then length is set to the object size
|
||||
// for invalid inputs, it returns no error, but isValid=false
|
||||
// `InvalidRange` error is returnd, only if startoffset is greater than the object size
|
||||
// for invalid inputs, it returns isValid=false and error=nil
|
||||
// `InvalidRange` error is returned only if startoffset is greater than the object size
|
||||
func ParseObjectRange(size int64, acceptRange string) (int64, int64, bool, error) {
|
||||
// Return full object (invalid range, no error) if header empty
|
||||
if acceptRange == "" {
|
||||
@@ -498,7 +498,7 @@ type PreConditions struct {
|
||||
// - if-none-match
|
||||
// - if-modified-since
|
||||
// - if-unmodified-since
|
||||
// if-match and if-none-match are ETag comparisions
|
||||
// if-match and if-none-match are ETag comparisons
|
||||
// if-modified-since and if-unmodified-since are last modifed time comparisons
|
||||
func EvaluatePreconditions(etag string, modTime time.Time, preconditions PreConditions) error {
|
||||
if preconditions.IfMatch == nil && preconditions.IfNoneMatch == nil && preconditions.IfModSince == nil && preconditions.IfUnmodeSince == nil {
|
||||
|
||||
@@ -2242,7 +2242,7 @@ func (p *Posix) loadObjectMetadata(f *os.File, bucket, object string) map[string
|
||||
if len(result) != 0 {
|
||||
err = p.storeObjectMetadata(f, bucket, object, result)
|
||||
if err == nil {
|
||||
// if it succeded to store the metadata as a json
|
||||
// if it succeeded to store the metadata as a json
|
||||
// object in user.metadata, cleanup the legacy X-Amz-Meta.
|
||||
// attributes
|
||||
for _, attr := range legacyAttrs {
|
||||
|
||||
@@ -302,7 +302,7 @@ func TestProcessController(t *testing.T) {
|
||||
expected expected
|
||||
}{
|
||||
{
|
||||
name: "no services successfull response",
|
||||
name: "no services successful response",
|
||||
args: args{
|
||||
svc: &Services{},
|
||||
controller: func(ctx *fiber.Ctx) (*Response, error) {
|
||||
|
||||
@@ -240,7 +240,7 @@ func validateAlgorithm(algo string) error {
|
||||
case algoECDSA:
|
||||
return s3err.QueryAuthErrors.OnlyHMACSupported()
|
||||
default:
|
||||
// all other algorithms are considerd as invalid
|
||||
// all other algorithms are considered as invalid
|
||||
return s3err.QueryAuthErrors.UnsupportedAlgorithm()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,7 +966,7 @@ func ConvertToStringPtr[T any](val T) *string {
|
||||
return &str
|
||||
}
|
||||
|
||||
// Converst any pointer to a string pointer
|
||||
// Converts any pointer to a string pointer
|
||||
func ConvertPtrToStringPtr[T any](val *T) *string {
|
||||
if val == nil {
|
||||
return nil
|
||||
|
||||
@@ -210,7 +210,7 @@ func AbortMultipartUpload_if_match_initiated_time(s *S3Conf) error {
|
||||
{initiated, nil},
|
||||
// should ignore future dates
|
||||
{getPtr(initiated.AddDate(1, 0, 0)), nil},
|
||||
// should fail if the initation date doesn't match
|
||||
// should fail if the initiated date doesn't match
|
||||
{getPtr(initiated.AddDate(-1, 0, 1)), s3err.GetAPIError(s3err.ErrPreconditionFailed)},
|
||||
} {
|
||||
err := abortMp(test.date)
|
||||
|
||||
@@ -1626,8 +1626,8 @@ func CompleteMultipartUpload_invalid_part_number(s *S3Conf) error {
|
||||
})
|
||||
}
|
||||
|
||||
func CompleteMultipartUpload_defualt_content_type(s *S3Conf) error {
|
||||
testName := "CompleteMultipartUpload_defualt_content_type"
|
||||
func CompleteMultipartUpload_default_content_type(s *S3Conf) error {
|
||||
testName := "CompleteMultipartUpload_default_content_type"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
obj := "my-object"
|
||||
mp, err := createMp(s3client, bucket, obj)
|
||||
|
||||
@@ -503,7 +503,7 @@ func TestCompleteMultipartUpload(ts *TestState) {
|
||||
ts.Run(CompletedMultipartUpload_non_existing_bucket)
|
||||
ts.Run(CompleteMultipartUpload_incorrect_part_number)
|
||||
ts.Run(CompleteMultipartUpload_invalid_part_number)
|
||||
ts.Run(CompleteMultipartUpload_defualt_content_type)
|
||||
ts.Run(CompleteMultipartUpload_default_content_type)
|
||||
ts.Run(CompleteMultipartUpload_invalid_ETag)
|
||||
ts.Run(CompleteMultipartUpload_small_upload_size)
|
||||
ts.Run(CompleteMultipartUpload_empty_parts)
|
||||
@@ -1586,7 +1586,7 @@ func GetIntTests() IntTests {
|
||||
"AbortMultipartUpload_if_match_initiated_time": AbortMultipartUpload_if_match_initiated_time,
|
||||
"CompletedMultipartUpload_non_existing_bucket": CompletedMultipartUpload_non_existing_bucket,
|
||||
"CompleteMultipartUpload_invalid_part_number": CompleteMultipartUpload_invalid_part_number,
|
||||
"CompleteMultipartUpload_defualt_content_type": CompleteMultipartUpload_defualt_content_type,
|
||||
"CompleteMultipartUpload_default_content_type": CompleteMultipartUpload_default_content_type,
|
||||
"CompleteMultipartUpload_invalid_ETag": CompleteMultipartUpload_invalid_ETag,
|
||||
"CompleteMultipartUpload_small_upload_size": CompleteMultipartUpload_small_upload_size,
|
||||
"CompleteMultipartUpload_empty_parts": CompleteMultipartUpload_empty_parts,
|
||||
|
||||
@@ -1715,7 +1715,7 @@ func extractCORSHeaders(resp *http.Response) (*PreflightResult, error) {
|
||||
var errResp smithy.GenericAPIError
|
||||
err = xml.Unmarshal(body, &errResp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unmarshal respone body: %w", err)
|
||||
return nil, fmt.Errorf("unmarshal response body: %w", err)
|
||||
}
|
||||
|
||||
return &PreflightResult{
|
||||
|
||||
@@ -2,9 +2,10 @@ package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/versity/versitygw/tests/rest_scripts/logger"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/versity/versitygw/tests/rest_scripts/logger"
|
||||
)
|
||||
|
||||
type OpenSSLCommand struct {
|
||||
@@ -64,14 +65,14 @@ func (o *OpenSSLCommand) Render() error {
|
||||
return fmt.Errorf("error writing to file: %w", err)
|
||||
}
|
||||
if o.Config.PayloadFile != "" || o.Config.Payload != "" {
|
||||
if err = o.writePayload(file); err != nil {
|
||||
if err = o.writePayload(); err != nil {
|
||||
return fmt.Errorf("error writing openssl payload: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *OpenSSLCommand) writePayload(file *os.File) error {
|
||||
func (o *OpenSSLCommand) writePayload() error {
|
||||
if awsPayload, ok := o.payloadManager.(*PayloadStreamingAWS4HMACSHA256); ok {
|
||||
awsPayload.AddInitialSignatureAndSigningKey(o.signature, o.signingKey)
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/versity/versitygw/tests/rest_scripts/logger"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/versity/versitygw/tests/rest_scripts/logger"
|
||||
)
|
||||
|
||||
type S3Request struct {
|
||||
@@ -104,7 +105,7 @@ func (s *S3Request) calculateCanonicalRequestHash() error {
|
||||
|
||||
canonicalQuery, err := s.getCanonicalQuery()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error generating canoncial query: %w", err)
|
||||
return fmt.Errorf("error generating canonical query: %w", err)
|
||||
}
|
||||
canonicalRequestLines = append(canonicalRequestLines, canonicalQuery)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user