From ba9df51b2e83b48ca8729ec0fb6a9c37ac465fe9 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Fri, 20 Oct 2023 20:31:17 +0200 Subject: [PATCH] fix or suppress lint warnings detected by golangci-lint 1.55.0 Signed-off-by: Nicola Murino --- go.mod | 19 +++---- go.sum | 36 ++++++------ internal/common/protocol_test.go | 14 ++--- internal/config/config_test.go | 2 +- internal/dataprovider/mysql.go | 2 +- internal/ftpd/cryptfs_test.go | 4 +- internal/ftpd/ftpd_test.go | 2 +- internal/httpd/httpd_test.go | 96 ++++++++++++++++---------------- internal/httpd/internal_test.go | 10 ++-- internal/httpd/middleware.go | 2 +- internal/httpd/oidc_test.go | 2 +- internal/httpd/server.go | 10 ++-- internal/httpdtest/httpfsimpl.go | 2 +- internal/sftpd/cryptfs_test.go | 2 +- internal/sftpd/sftpd_test.go | 16 +++--- internal/util/util.go | 11 ++-- internal/webdavd/webdavd_test.go | 6 +- 17 files changed, 118 insertions(+), 118 deletions(-) diff --git a/go.mod b/go.mod index 76b75f16..94217f0a 100644 --- a/go.mod +++ b/go.mod @@ -16,11 +16,11 @@ require ( github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.91 github.com/aws/aws-sdk-go-v2/service/marketplacemetering v1.16.2 github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.5 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.6 github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/cockroachdb/cockroach-go/v2 v2.3.5 - github.com/coreos/go-oidc/v3 v3.6.0 + github.com/coreos/go-oidc/v3 v3.7.0 github.com/drakkan/webdav v0.0.0-20230227175313-32996838bcd8 github.com/eikenb/pipeat v0.0.0-20210730190139-06b3e6902001 github.com/fclairamb/ftpserverlib v0.22.0 @@ -39,7 +39,7 @@ require ( github.com/jackc/pgx/v5 v5.4.3 github.com/jlaffaye/ftp v0.0.0-20201112195030-9aae4d151126 github.com/klauspost/compress v1.17.1 - github.com/lestrrat-go/jwx/v2 v2.0.14 + github.com/lestrrat-go/jwx/v2 v2.0.15 github.com/lithammer/shortuuid/v3 v3.0.7 github.com/mattn/go-sqlite3 v1.14.17 github.com/mhale/smtpd v0.8.0 @@ -74,16 +74,16 @@ require ( golang.org/x/sys v0.13.0 golang.org/x/term v0.13.0 golang.org/x/time v0.3.0 - google.golang.org/api v0.147.0 + google.golang.org/api v0.148.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) require ( - cloud.google.com/go v0.110.8 // indirect + cloud.google.com/go v0.110.9 // indirect cloud.google.com/go/compute v1.23.1 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.3 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 // indirect github.com/ajg/form v1.5.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect @@ -112,7 +112,6 @@ require ( github.com/goccy/go-json v0.10.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.6.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect @@ -134,7 +133,7 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/miekg/dns v1.1.56 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect @@ -144,7 +143,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect @@ -169,7 +168,7 @@ require ( google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 37fba01c..3cc58f23 100644 --- a/go.sum +++ b/go.sum @@ -17,8 +17,8 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= +cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -53,8 +53,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0/go.mod h1:c+Lifp3EDEamAkPVzMooRNOK6CZjNSdEnf1A7jsI9u4= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 h1:gggzg0SUMs6SQbEw+3LoSsYf9YMjkupeAnHMX8O9mmY= @@ -103,8 +103,8 @@ github.com/aws/aws-sdk-go-v2/service/marketplacemetering v1.16.2 h1:ncD32ZGQwlOV github.com/aws/aws-sdk-go-v2/service/marketplacemetering v1.16.2/go.mod h1:BOLvSueHtDGyZ5QW10YU4F6UK4iP3wzu7QBUXjTDuQs= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2 h1:Ll5/YVCOzRB+gxPqs2uD0R7/MyATC0w85626glSKmp4= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2/go.mod h1:Zjfqt7KhQK+PO1bbOsFNzKgaq7TcxzmEoDWN8lM0qzQ= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.5 h1:BvRGAAdEHo+0tpyOlKV14Z49O/iyhqiddIntd0KQ3EA= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.5/go.mod h1:A108ijf0IFtqhYApU+Gia80aPSAUfi9dItm+h5fWGJE= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.6 h1:y3n83jEM6EuawrD5HZCh3eMj9RsfxniVLcXlyFMNITM= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.6/go.mod h1:A108ijf0IFtqhYApU+Gia80aPSAUfi9dItm+h5fWGJE= github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= @@ -136,8 +136,8 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/cockroach-go/v2 v2.3.5 h1:Khtm8K6fTTz/ZCWPzU9Ne3aOW9VyAnj4qIPCJgKtwK0= github.com/cockroachdb/cockroach-go/v2 v2.3.5/go.mod h1:1wNJ45eSXW9AnOc3skntW9ZUZz6gxrQK3cOj3rK+BC8= -github.com/coreos/go-oidc/v3 v3.6.0 h1:AKVxfYw1Gmkn/w96z0DbT/B/xFnzTd3MkZvWLjF4n/o= -github.com/coreos/go-oidc/v3 v3.6.0/go.mod h1:ZpHUsHBucTUj6WOkrP4E20UPynbLZzhTQ1XKCXkxyPc= +github.com/coreos/go-oidc/v3 v3.7.0 h1:FTdj0uexT4diYIPlF4yoFVI5MRO1r5+SEcIpEw9vC0o= +github.com/coreos/go-oidc/v3 v3.7.0/go.mod h1:yQzSCqBnK3e6Fs5l+f5i0F8Kwf0zpH9bPEsbY00KanM= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -351,8 +351,8 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.14 h1:qm02Xd/pIWSv70vVEutr3Zt7QULnnNRpM4N5+8hQBFs= -github.com/lestrrat-go/jwx/v2 v2.0.14/go.mod h1:jBHyESp4e7QxfERM0UKkQ80/94paqNIEcdEfiUYz5zE= +github.com/lestrrat-go/jwx/v2 v2.0.15 h1:XvR2lQdX+mZechmqWxqQb2foU3hgAn5+Rj0ICa0I6sU= +github.com/lestrrat-go/jwx/v2 v2.0.15/go.mod h1:jBHyESp4e7QxfERM0UKkQ80/94paqNIEcdEfiUYz5zE= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= @@ -377,8 +377,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mhale/smtpd v0.8.0 h1:5JvdsehCg33PQrZBvFyDMMUDQmvbzVpZgKob7eYBJc0= github.com/mhale/smtpd v0.8.0/go.mod h1:MQl+y2hwIEQCXtNhe5+55n0GZOjSmeqORDIXbqUL3x4= github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= @@ -422,8 +422,8 @@ github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+L github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -777,8 +777,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.147.0 h1:Can3FaQo9LlVqxJCodNmeZW/ib3/qKAY3rFeXiHo5gc= -google.golang.org/api v0.147.0/go.mod h1:pQ/9j83DcmPd/5C9e2nFOdjjNkDZ1G+zkbK2uvdkJMs= +google.golang.org/api v0.148.0 h1:HBq4TZlN4/1pNcu0geJZ/Q50vIwIXT532UIMYoo0vOs= +google.golang.org/api v0.148.0/go.mod h1:8/TBgwaKjfqTdacOJrOv2+2Q6fBDU1uHKK06oGSkxzU= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -846,8 +846,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/common/protocol_test.go b/internal/common/protocol_test.go index dab21090..f223af6d 100644 --- a/internal/common/protocol_test.go +++ b/internal/common/protocol_test.go @@ -293,7 +293,7 @@ func TestBaseConnection(t *testing.T) { assert.NoError(t, err) err = f.Close() assert.NoError(t, err) - linkName := testFileName + ".link" + linkName := testFileName + ".link" //nolint:goconst err = client.Rename(testFileName, testFileName) if assert.Error(t, err) { assert.Contains(t, err.Error(), "the rename source and target cannot be the same") @@ -398,7 +398,7 @@ func TestRelativeSymlinks(t *testing.T) { defer conn.Close() defer client.Close() - linkName := testFileName + "_link" + linkName := testFileName + "_link" //nolint:goconst err = client.Symlink("non-existent-file", linkName) assert.NoError(t, err) err = client.Remove(linkName) @@ -1013,7 +1013,7 @@ func TestHiddenRoot(t *testing.T) { assert.ErrorIs(t, err, os.ErrPermission) err = writeSFTPFile("ftp123", 4096, client) assert.ErrorIs(t, err, os.ErrPermission) - err = client.Rename(testFileName, testFileName+"_rename") + err = client.Rename(testFileName, testFileName+"_rename") //nolint:goconst assert.ErrorIs(t, err, os.ErrPermission) err = writeSFTPFile(path.Join("/ftp", testFileName), 4096, client) assert.NoError(t, err) @@ -1513,7 +1513,7 @@ func TestVirtualFoldersQuotaRenameOverwrite(t *testing.T) { assert.NoError(t, err) err = writeSFTPFile(path.Join(vdirPath3, testFileName+"1"), testFileSize, client) assert.NoError(t, err) - err = client.Rename(testFileName, path.Join(vdirPath1, testFileName+".rename")) + err = client.Rename(testFileName, path.Join(vdirPath1, testFileName+".rename")) //nolint:goconst assert.Error(t, err) // we overwrite an existing file and we have unlimited size err = client.Rename(testFileName, path.Join(vdirPath1, testFileName)) @@ -2708,7 +2708,7 @@ func TestVirtualFoldersLink(t *testing.T) { assert.NoError(t, err) err = client.Symlink(path.Join(vdirPath2, testFileName), path.Join(vdirPath2, testDir, testFileName+".link")) assert.NoError(t, err) - err = client.Symlink(path.Join("/", testFileName), path.Join(vdirPath1, testFileName+".link1")) + err = client.Symlink(path.Join("/", testFileName), path.Join(vdirPath1, testFileName+".link1")) //nolint:goconst if assert.Error(t, err) { assert.Contains(t, err.Error(), "SSH_FX_OP_UNSUPPORTED") } @@ -4418,7 +4418,7 @@ func TestEventRuleFsActions(t *testing.T) { assert.NoError(t, err) _, err = client.Stat(path.Join("basedir", testFileName)) assert.Error(t, err) - info, err := client.Stat(testFileName + "_renamed") + info, err := client.Stat(testFileName + "_renamed") //nolint:goconst if assert.NoError(t, err) { assert.Equal(t, size, info.Size()) } @@ -5189,7 +5189,7 @@ func TestEventActionCompress(t *testing.T) { assert.NoError(t, err) err = f.Close() assert.NoError(t, err) - info, err := client.Stat(testFileName + ".zip") + info, err := client.Stat(testFileName + ".zip") //nolint:goconst if assert.NoError(t, err) { assert.Greater(t, info.Size(), int64(0)) // check quota diff --git a/internal/config/config_test.go b/internal/config/config_test.go index cfa838b6..f7ee8a25 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -65,7 +65,7 @@ func TestLoadConfigTest(t *testing.T) { assert.NotEqual(t, sftpd.Configuration{}, config.GetSFTPDConfig()) assert.NotEqual(t, httpclient.Config{}, config.GetHTTPConfig()) assert.NotEqual(t, smtp.Config{}, config.GetSMTPConfig()) - confName := tempConfigName + ".json" + confName := tempConfigName + ".json" //nolint:goconst configFilePath := filepath.Join(configDir, confName) err = config.LoadConfig(configDir, confName) assert.NoError(t, err) diff --git a/internal/dataprovider/mysql.go b/internal/dataprovider/mysql.go index 4569d95d..02c13d36 100644 --- a/internal/dataprovider/mysql.go +++ b/internal/dataprovider/mysql.go @@ -115,7 +115,7 @@ const ( "ALTER TABLE `{{users_groups_mapping}}` ADD CONSTRAINT `{{prefix}}users_groups_mapping_group_id_fk_groups_id` " + "FOREIGN KEY (`group_id`) REFERENCES `{{groups}}` (`id`) ON DELETE NO ACTION;" + "ALTER TABLE `{{users_groups_mapping}}` ADD CONSTRAINT `{{prefix}}users_groups_mapping_user_id_fk_users_id` " + - "FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE;" + + "FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE; " + "ALTER TABLE `{{groups_folders_mapping}}` ADD CONSTRAINT `{{prefix}}groups_folders_mapping_folder_id_fk_folders_id` " + "FOREIGN KEY (`folder_id`) REFERENCES `{{folders}}` (`id`) ON DELETE CASCADE;" + "ALTER TABLE `{{groups_folders_mapping}}` ADD CONSTRAINT `{{prefix}}groups_folders_mapping_group_id_fk_groups_id` " + diff --git a/internal/ftpd/cryptfs_test.go b/internal/ftpd/cryptfs_test.go index 950d99b9..3f3d96c1 100644 --- a/internal/ftpd/cryptfs_test.go +++ b/internal/ftpd/cryptfs_test.go @@ -281,11 +281,11 @@ func TestResumeCryptFs(t *testing.T) { assert.Equal(t, initialHash, downloadHash) err = os.Truncate(localDownloadPath, 32767) assert.NoError(t, err) - err = ftpDownloadFile(testFileName, localDownloadPath+"_partial", testFileSize-32767, client, 32767) + err = ftpDownloadFile(testFileName, localDownloadPath+"_partial", testFileSize-32767, client, 32767) //nolint:goconst assert.NoError(t, err) file, err := os.OpenFile(localDownloadPath, os.O_APPEND|os.O_WRONLY, os.ModePerm) assert.NoError(t, err) - file1, err := os.Open(localDownloadPath + "_partial") + file1, err := os.Open(localDownloadPath + "_partial") //nolint:goconst assert.NoError(t, err) _, err = io.Copy(file, file1) assert.NoError(t, err) diff --git a/internal/ftpd/ftpd_test.go b/internal/ftpd/ftpd_test.go index 2f9c7c70..332ef5db 100644 --- a/internal/ftpd/ftpd_test.go +++ b/internal/ftpd/ftpd_test.go @@ -2291,7 +2291,7 @@ func TestQuotaLimits(t *testing.T) { // test quota files client, err := getFTPClient(user, false, nil) if assert.NoError(t, err) { - err = ftpUploadFile(testFilePath, testFileName+".quota", testFileSize, client, 0) + err = ftpUploadFile(testFilePath, testFileName+".quota", testFileSize, client, 0) //nolint:goconst assert.NoError(t, err) err = ftpUploadFile(testFilePath, testFileName+".quota1", testFileSize, client, 0) assert.Error(t, err) diff --git a/internal/httpd/httpd_test.go b/internal/httpd/httpd_test.go index dd875be7..73857c34 100644 --- a/internal/httpd/httpd_test.go +++ b/internal/httpd/httpd_test.go @@ -1379,8 +1379,8 @@ func TestGroupSettingsOverride(t *testing.T) { assert.Equal(t, altAdminUsername, user.FsConfig.SFTPConfig.Username) assert.Equal(t, "/dirs/"+defaultUsername, user.FsConfig.SFTPConfig.Prefix) assert.Equal(t, []string{dataprovider.PermListItems, dataprovider.PermUpload}, user.GetPermissionsForPath("/")) - assert.Equal(t, []string{dataprovider.PermDelete}, user.GetPermissionsForPath("/"+defaultUsername)) - assert.Equal(t, []string{dataprovider.PermRename}, user.GetPermissionsForPath("/sub/"+defaultUsername)) + assert.Equal(t, []string{dataprovider.PermDelete}, user.GetPermissionsForPath(path.Join("/", defaultUsername))) + assert.Equal(t, []string{dataprovider.PermRename}, user.GetPermissionsForPath(path.Join("/sub", defaultUsername))) assert.Equal(t, group1.UserSettings.MaxSessions, user.MaxSessions) assert.Equal(t, group1.UserSettings.QuotaFiles, user.QuotaFiles) assert.Equal(t, group1.UserSettings.UploadBandwidth, user.UploadBandwidth) @@ -1388,7 +1388,7 @@ func TestGroupSettingsOverride(t *testing.T) { assert.Equal(t, group1.UserSettings.Filters.MaxUploadFileSize, user.Filters.MaxUploadFileSize) assert.Equal(t, "/startdir/"+defaultUsername, user.Filters.StartDirectory) if assert.Len(t, user.Filters.FilePatterns, 1) { - assert.Equal(t, "/sub2/"+defaultUsername+"test", user.Filters.FilePatterns[0].Path) + assert.Equal(t, "/sub2/"+defaultUsername+"test", user.Filters.FilePatterns[0].Path) //nolint:goconst } if assert.Len(t, user.Filters.WebClient, 2) { assert.Contains(t, user.Filters.WebClient, sdk.WebClientInfoChangeDisabled) @@ -1510,7 +1510,7 @@ func TestBasicIPListEntriesHandling(t *testing.T) { _, _, err = httpdtest.AddIPListEntry(entry, http.StatusInternalServerError) assert.NoError(t, err) // adding an entry with an invalid IP should fail - entry.IPOrNet = "invalid" + entry.IPOrNet = "not valid" _, _, err = httpdtest.AddIPListEntry(entry, http.StatusBadRequest) assert.NoError(t, err) // adding an entry with an incompatible mode should fail @@ -3123,14 +3123,14 @@ func TestLoginRedirectNext(t *testing.T) { user, _, err := httpdtest.AddUser(getTestUser(), http.StatusCreated) assert.NoError(t, err) - uri := webClientFilesPath + "?path=%2F" + uri := webClientFilesPath + "?path=%2F" //nolint:goconst req, err := http.NewRequest(http.MethodGet, uri, nil) assert.NoError(t, err) req.RequestURI = uri rr := executeRequest(req) checkResponseCode(t, http.StatusFound, rr) redirectURI := rr.Header().Get("Location") - assert.Equal(t, webClientLoginPath+"?next="+url.QueryEscape(uri), redirectURI) + assert.Equal(t, webClientLoginPath+"?next="+url.QueryEscape(uri), redirectURI) //nolint:goconst // render the login page req, err = http.NewRequest(http.MethodGet, redirectURI, nil) assert.NoError(t, err) @@ -6443,7 +6443,7 @@ func TestNamingRules(t *testing.T) { assert.NoError(t, err) userAPIToken, err := getJWTAPIUserTokenFromTestServer(user.Username, defaultPassword) assert.NoError(t, err) - req, err = http.NewRequest(http.MethodPut, userPath+"/"+user.Username+"/2fa/disable", nil) + req, err = http.NewRequest(http.MethodPut, userPath+"/"+user.Username+"/2fa/disable", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, adminAPIToken) rr = executeRequest(req) @@ -8599,13 +8599,13 @@ func TestEventRuleErrorsMock(t *testing.T) { assert.NoError(t, err) reqBody := bytes.NewBuffer([]byte("invalid json body")) - req, err := http.NewRequest(http.MethodGet, eventActionsPath+"?limit=a", nil) + req, err := http.NewRequest(http.MethodGet, eventActionsPath+"?limit=b", nil) assert.NoError(t, err) setBearerForReq(req, token) rr := executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, err = http.NewRequest(http.MethodGet, eventRulesPath+"?limit=a", nil) + req, err = http.NewRequest(http.MethodGet, eventRulesPath+"?limit=c", nil) assert.NoError(t, err) setBearerForReq(req, token) rr = executeRequest(req) @@ -8683,7 +8683,7 @@ func TestGroupErrorsMock(t *testing.T) { rr := executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, err = http.NewRequest(http.MethodGet, groupPath+"?limit=a", nil) + req, err = http.NewRequest(http.MethodGet, groupPath+"?limit=d", nil) assert.NoError(t, err) setBearerForReq(req, token) rr = executeRequest(req) @@ -9958,14 +9958,14 @@ func TestSearchEvents(t *testing.T) { assert.Equal(t, http.ErrAbortHandler, rcv) }() - req, err = http.NewRequest(http.MethodGet, fsEventsPath+"?start_timestamp=-1&csv_export=true", nil) + req, err = http.NewRequest(http.MethodGet, fsEventsPath+"?start_timestamp=-2&csv_export=true", nil) assert.NoError(t, err) setBearerForReq(req, token) rr = executeRequest(req) } exportFunc() - req, err = http.NewRequest(http.MethodGet, fsEventsPath+"?limit=a", nil) + req, err = http.NewRequest(http.MethodGet, fsEventsPath+"?limit=e", nil) assert.NoError(t, err) setBearerForReq(req, token) rr = executeRequest(req) @@ -10712,7 +10712,7 @@ func TestWebAPIChangeUserProfileMock(t *testing.T) { profileReq = make(map[string]any) profileReq["allow_api_key_auth"] = false profileReq["email"] = email - profileReq["description"] = description + "_mod" + profileReq["description"] = description + "_mod" //nolint:goconst profileReq["public_keys"] = []string{testPubKey} asJSON, err = json.Marshal(profileReq) assert.NoError(t, err) @@ -11392,7 +11392,7 @@ func TestUpdateUserQuotaUsageMock(t *testing.T) { // now update only quota size u.UsedQuotaFiles = 0 userAsJSON = getUserAsJSON(t, u) - req, _ = http.NewRequest(http.MethodPut, path.Join(quotasBasePath, "users", u.Username, "usage")+"?mode=add", bytes.NewBuffer(userAsJSON)) + req, _ = http.NewRequest(http.MethodPut, path.Join(quotasBasePath, "users", u.Username, "usage")+"?mode=add", bytes.NewBuffer(userAsJSON)) //nolint:goconst setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) @@ -11612,7 +11612,7 @@ func TestGetAdminsMock(t *testing.T) { setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, _ = http.NewRequest(http.MethodGet, adminPath+"?limit=1&offset=a&order=ASC", nil) + req, _ = http.NewRequest(http.MethodGet, adminPath+"?limit=1&offset=aa&order=ASC", nil) setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) @@ -11646,7 +11646,7 @@ func TestGetUsersMock(t *testing.T) { err = render.DecodeJSON(rr.Body, &users) assert.NoError(t, err) assert.GreaterOrEqual(t, len(users), 1) - req, _ = http.NewRequest(http.MethodGet, userPath+"?limit=a&offset=0&order=ASC", nil) + req, _ = http.NewRequest(http.MethodGet, userPath+"?limit=aa&offset=0&order=ASC", nil) setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) @@ -11654,7 +11654,7 @@ func TestGetUsersMock(t *testing.T) { setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, _ = http.NewRequest(http.MethodGet, userPath+"?limit=1&offset=0&order=ASCa", nil) + req, _ = http.NewRequest(http.MethodGet, userPath+"?limit=1&offset=0&order=ASCc", nil) setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) @@ -11943,7 +11943,7 @@ func TestGetFoldersMock(t *testing.T) { setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, _ = http.NewRequest(http.MethodGet, folderPath+"?limit=1&offset=0&order=ASCa", nil) + req, _ = http.NewRequest(http.MethodGet, folderPath+"?limit=1&offset=0&order=ASCV", nil) setBearerForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) @@ -12197,7 +12197,7 @@ func TestWebAPILoginMock(t *testing.T) { checkResponseCode(t, http.StatusUnauthorized, rr) assert.Contains(t, rr.Body.String(), "Your token audience is not valid") - req, err = http.NewRequest(http.MethodGet, userDirsPath+"/?path=%2F", nil) + req, err = http.NewRequest(http.MethodGet, userDirsPath+"/?path=%2F", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, apiToken) rr = executeRequest(req) @@ -12597,7 +12597,7 @@ func TestMaxSessions(t *testing.T) { checkResponseCode(t, http.StatusTooManyRequests, rr) assert.Contains(t, rr.Body.String(), "too many open sessions") - req, err = http.NewRequest(http.MethodGet, webClientEditFilePath+"?path=file", nil) + req, err = http.NewRequest(http.MethodGet, webClientEditFilePath+"?path=file", nil) //nolint:goconst assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr = executeRequest(req) @@ -13118,7 +13118,7 @@ func TestPreDownloadHook(t *testing.T) { assert.NoError(t, err) webAPIToken, err := getJWTAPIUserTokenFromTestServer(defaultUsername, defaultPassword) assert.NoError(t, err) - req, err := http.NewRequest(http.MethodGet, webClientFilesPath+"?path="+testFileName, nil) + req, err := http.NewRequest(http.MethodGet, webClientFilesPath+"?path="+testFileName, nil) //nolint:goconst assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr := executeRequest(req) @@ -13779,7 +13779,7 @@ func TestShareMaxSessions(t *testing.T) { objectID := rr.Header().Get("X-Object-ID") assert.NotEmpty(t, objectID) - req, err = http.NewRequest(http.MethodGet, sharesPath+"/"+objectID+"/dirs", nil) + req, err = http.NewRequest(http.MethodGet, sharesPath+"/"+objectID+"/dirs", nil) //nolint:goconst assert.NoError(t, err) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) @@ -14015,7 +14015,7 @@ func TestShareReadWrite(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) - req, err = http.NewRequest(http.MethodGet, path.Join(webClientPubSharesPath, objectID, "browse?path="+testFileName), nil) + req, err = http.NewRequest(http.MethodGet, path.Join(webClientPubSharesPath, objectID, "browse?path="+testFileName), nil) //nolint:goconst assert.NoError(t, err) req.SetBasicAuth(defaultUsername, defaultPassword) rr = executeRequest(req) @@ -14109,7 +14109,7 @@ func TestShareUncompressed(t *testing.T) { checkResponseCode(t, http.StatusOK, rr) assert.Equal(t, "application/zip", rr.Header().Get("Content-Type")) - req, err = http.NewRequest(http.MethodGet, webClientPubSharesPath+"/"+objectID+"?compress=false", nil) + req, err = http.NewRequest(http.MethodGet, webClientPubSharesPath+"/"+objectID+"?compress=false", nil) //nolint:goconst assert.NoError(t, err) req.SetBasicAuth(defaultUsername, defaultPassword) rr = executeRequest(req) @@ -14357,7 +14357,7 @@ func TestBrowseShares(t *testing.T) { checkResponseCode(t, http.StatusBadRequest, rr) assert.Contains(t, rr.Body.String(), "Invalid share path") - req, err = http.NewRequest(http.MethodGet, path.Join(sharesPath, objectID, "files?path="+testFileName), nil) + req, err = http.NewRequest(http.MethodGet, path.Join(sharesPath, objectID, "files?path="+testFileName), nil) //nolint:goconst assert.NoError(t, err) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) @@ -15181,7 +15181,7 @@ func TestWebClientViewPDF(t *testing.T) { err = os.WriteFile(filepath.Join(user.GetHomeDir(), "test.pdf"), []byte("some text data"), 0666) assert.NoError(t, err) - req, err = http.NewRequest(http.MethodGet, webClientGetPDFPath+"?path=%2Ftest.pdf", nil) + req, err = http.NewRequest(http.MethodGet, webClientGetPDFPath+"?path=%2Ftest.pdf", nil) //nolint:goconst assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr = executeRequest(req) @@ -15381,7 +15381,7 @@ func TestWebGetFiles(t *testing.T) { assert.NoError(t, err) assert.Len(t, dirEntries, 1) - req, _ = http.NewRequest(http.MethodGet, webClientDownloadZipPath+"?path="+url.QueryEscape("/")+"&files="+ + req, _ = http.NewRequest(http.MethodGet, webClientDownloadZipPath+"?path="+url.QueryEscape("/")+"&files="+ //nolint:goconst url.QueryEscape(fmt.Sprintf(`["%v","%v","%v"]`, testFileName, testDir, testFileName+extensions[2])), nil) setJWTCookieForReq(req, webToken) rr = executeRequest(req) @@ -15413,7 +15413,7 @@ func TestWebGetFiles(t *testing.T) { checkResponseCode(t, http.StatusInternalServerError, rr) assert.Contains(t, rr.Body.String(), "Unable to get files list") - req, _ = http.NewRequest(http.MethodGet, webClientDirsPath+"?path=/", nil) + req, _ = http.NewRequest(http.MethodGet, webClientDirsPath+"?path=/", nil) //nolint:goconst setJWTCookieForReq(req, webToken) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) @@ -15645,7 +15645,7 @@ func TestRenameDifferentResource(t *testing.T) { webAPIToken, err := getJWTAPIUserTokenFromTestServer(defaultUsername, defaultPassword) assert.NoError(t, err) - req, err := http.NewRequest(http.MethodPost, userFileActionsPath+"/move?path="+testFileName+"&target="+url.QueryEscape(path.Join("/", "folderPath", testFileName)), nil) + req, err := http.NewRequest(http.MethodPost, userFileActionsPath+"/move?path="+testFileName+"&target="+url.QueryEscape(path.Join("/", "folderPath", testFileName)), nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr := executeRequest(req) @@ -15706,13 +15706,13 @@ func TestWebDirsAPI(t *testing.T) { assert.Len(t, contents, 0) // rename a missing folder - req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/move?path="+testDir+"&target="+testDir+"new", nil) + req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/move?path="+testDir+"&target="+testDir+"new", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) checkResponseCode(t, http.StatusNotFound, rr) // copy a missing folder - req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/copy?path="+testDir+"%2F&target="+testDir+"new%2F", nil) + req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/copy?path="+testDir+"%2F&target="+testDir+"new%2F", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -15768,7 +15768,7 @@ func TestWebDirsAPI(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusNotFound, rr) // setting the mkdir_parents param will work - req, err = http.NewRequest(http.MethodPost, userDirsPath+"?mkdir_parents=true&path="+url.QueryEscape(path.Join("/sub/dir", testDir)), nil) + req, err = http.NewRequest(http.MethodPost, userDirsPath+"?mkdir_parents=true&path="+url.QueryEscape(path.Join("/sub/dir", testDir)), nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -15860,7 +15860,7 @@ func TestWebUploadSingleFile(t *testing.T) { assert.Contains(t, rr.Body.String(), "please set a file path") modTime := time.Now().Add(-24 * time.Hour) - req, err = http.NewRequest(http.MethodPost, userUploadFilePath+"?path=file.txt", bytes.NewBuffer(content)) + req, err = http.NewRequest(http.MethodPost, userUploadFilePath+"?path=file.txt", bytes.NewBuffer(content)) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) req.Header.Set("X-SFTPGO-MTIME", strconv.FormatInt(util.GetTimeAsMsSinceEpoch(modTime), 10)) @@ -15908,7 +15908,7 @@ func TestWebUploadSingleFile(t *testing.T) { assert.InDelta(t, util.GetTimeAsMsSinceEpoch(modTime), util.GetTimeAsMsSinceEpoch(info.ModTime()), float64(1000)) } // missing file - req, err = http.NewRequest(http.MethodPatch, userFilesDirsMetadataPath+"?path=file2.txt", bytes.NewBuffer(asJSON)) + req, err = http.NewRequest(http.MethodPatch, userFilesDirsMetadataPath+"?path=file2.txt", bytes.NewBuffer(asJSON)) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -16022,7 +16022,7 @@ func TestWebFilesAPI(t *testing.T) { assert.NoError(t, err) assert.Len(t, contents, 2) // download a file - req, err = http.NewRequest(http.MethodGet, userFilesPath+"?path=file1.txt", nil) + req, err = http.NewRequest(http.MethodGet, userFilesPath+"?path=file1.txt", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -16108,7 +16108,7 @@ func TestWebFilesAPI(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) // rename a file - req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/move?path=file1.txt&target=%2Ftdir%2Ffile3.txt", nil) + req, err = http.NewRequest(http.MethodPost, userFileActionsPath+"/move?target=%2Ftdir%2Ffile3.txt&path=file1.txt", nil) assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -16651,7 +16651,7 @@ func TestWebUploadErrors(t *testing.T) { checkResponseCode(t, http.StatusForbidden, rr) assert.Contains(t, rr.Body.String(), "Error checking parent directories") // create a dir and try to overwrite it with a file - req, err = http.NewRequest(http.MethodPost, userDirsPath+"?path=file.zip", nil) + req, err = http.NewRequest(http.MethodPost, userDirsPath+"?path=file.zip", nil) //nolint:goconst assert.NoError(t, err) setBearerForReq(req, webAPIToken) rr = executeRequest(req) @@ -17938,14 +17938,14 @@ func TestWebUserShare(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) - req, err = http.NewRequest(http.MethodGet, webClientSharesPath+"?qlimit=a", nil) + req, err = http.NewRequest(http.MethodGet, webClientSharesPath+"?qlimit=aa", nil) assert.NoError(t, err) req.RemoteAddr = defaultRemoteAddr setJWTCookieForReq(req, token) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) - req, err = http.NewRequest(http.MethodGet, webClientSharesPath+"?qlimit=1", nil) + req, err = http.NewRequest(http.MethodGet, webClientSharesPath+"?qlimit=1", nil) //nolint:goconst assert.NoError(t, err) req.RemoteAddr = defaultRemoteAddr setJWTCookieForReq(req, token) @@ -18552,7 +18552,7 @@ func TestAPIKeySearch(t *testing.T) { assert.NoError(t, err) assert.Len(t, keys, 0) - req, err = http.NewRequest(http.MethodGet, apiKeysPath+"?limit=a", nil) + req, err = http.NewRequest(http.MethodGet, apiKeysPath+"?limit=f", nil) assert.NoError(t, err) setBearerForReq(req, token) rr = executeRequest(req) @@ -18736,7 +18736,7 @@ func TestBasicWebUsersMock(t *testing.T) { setJWTCookieForReq(req, webToken) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) - req, _ = http.NewRequest(http.MethodGet, webUsersPath+"?qlimit=a", nil) + req, _ = http.NewRequest(http.MethodGet, webUsersPath+"?qlimit=ab", nil) setJWTCookieForReq(req, webToken) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) @@ -18949,7 +18949,7 @@ func TestWebAdminBasicMock(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) - req, _ = http.NewRequest(http.MethodGet, webAdminsPath+"?qlimit=a", nil) + req, _ = http.NewRequest(http.MethodGet, webAdminsPath+"?qlimit=ac", nil) req.RemoteAddr = defaultRemoteAddr setJWTCookieForReq(req, token) rr = executeRequest(req) @@ -20701,8 +20701,8 @@ func TestFolderTemplateMock(t *testing.T) { require.Equal(t, folder1, dump.Folders[0].FsConfig.S3Config.AccessKey) err = dump.Folders[0].FsConfig.S3Config.AccessSecret.Decrypt() require.NoError(t, err) - require.Equal(t, "pwd"+folder1, dump.Folders[0].FsConfig.S3Config.AccessSecret.GetPayload()) - require.Equal(t, "base/"+folder1+"/", dump.Folders[0].FsConfig.S3Config.KeyPrefix) + require.Equal(t, fmt.Sprintf("pwd%s", folder1), dump.Folders[0].FsConfig.S3Config.AccessSecret.GetPayload()) + require.Equal(t, path.Join("base", folder1)+"/", dump.Folders[0].FsConfig.S3Config.KeyPrefix) require.Equal(t, folder2, dump.Folders[1].Name) require.Equal(t, folder2, dump.Folders[1].FsConfig.S3Config.AccessKey) err = dump.Folders[1].FsConfig.S3Config.AccessSecret.Decrypt() @@ -21849,7 +21849,7 @@ func TestWebEventAction(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) // list actions - req, err = http.NewRequest(http.MethodGet, webAdminEventActionsPath+"?qlimit=a", nil) + req, err = http.NewRequest(http.MethodGet, webAdminEventActionsPath+"?qlimit=aaa", nil) assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr = executeRequest(req) @@ -22560,7 +22560,7 @@ func TestWebIPListEntries(t *testing.T) { rr = executeRequest(req) checkResponseCode(t, http.StatusBadRequest, rr) - req, err = http.NewRequest(http.MethodGet, webIPListPath+"/1/a", nil) + req, err = http.NewRequest(http.MethodGet, path.Join(webIPListPath, "/1/a"), nil) assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr = executeRequest(req) @@ -22655,14 +22655,14 @@ func TestWebIPListEntries(t *testing.T) { assert.Equal(t, dataprovider.ListModeAllow, entry2.Mode) assert.Equal(t, entry.Protocols, entry2.Protocols) - req, err = http.NewRequest(http.MethodGet, webIPListPath+"/1/"+url.PathEscape(entry2.IPOrNet), nil) + req, err = http.NewRequest(http.MethodGet, path.Join(webIPListPath, "1", url.PathEscape(entry2.IPOrNet)), nil) assert.NoError(t, err) setJWTCookieForReq(req, webToken) rr = executeRequest(req) checkResponseCode(t, http.StatusOK, rr) form.Set("protocols", "1") - req, err = http.NewRequest(http.MethodPost, webIPListPath+"/1/"+url.PathEscape(entry.IPOrNet), + req, err = http.NewRequest(http.MethodPost, path.Join(webIPListPath, "1", url.PathEscape(entry.IPOrNet)), bytes.NewBuffer([]byte(form.Encode()))) assert.NoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") diff --git a/internal/httpd/internal_test.go b/internal/httpd/internal_test.go index f7f7702e..8835fe8a 100644 --- a/internal/httpd/internal_test.go +++ b/internal/httpd/internal_test.go @@ -1024,7 +1024,7 @@ func TestOAuth2Redirect(t *testing.T) { ip := "127.1.1.4" tokenString := createOAuth2Token(xid.New().String(), ip) rr = httptest.NewRecorder() - req, err = http.NewRequest(http.MethodGet, webOAuth2RedirectPath+"?state="+tokenString, nil) + req, err = http.NewRequest(http.MethodGet, webOAuth2RedirectPath+"?state="+tokenString, nil) //nolint:goconst assert.NoError(t, err) req.RemoteAddr = ip server.handleOAuth2TokenRedirect(rr, req) @@ -1173,7 +1173,7 @@ func TestCSRFToken(t *testing.T) { func TestCreateShareCookieError(t *testing.T) { username := "share_user" - pwd := "pwd" + pwd := util.GenerateUniqueID() user := &dataprovider.User{ BaseUser: sdk.BaseUser{ Username: username, @@ -1239,7 +1239,7 @@ func TestCreateTokenError(t *testing.T) { user := dataprovider.User{ BaseUser: sdk.BaseUser{ Username: "u", - Password: "pwd", + Password: util.GenerateUniqueID(), }, } req, _ = http.NewRequest(http.MethodGet, userTokenPath, nil) @@ -1284,12 +1284,12 @@ func TestCreateTokenError(t *testing.T) { _, err := getAdminFromPostFields(req) assert.Error(t, err) - req, _ = http.NewRequest(http.MethodPost, webAdminEventActionPath+"?a=a%C3%AO%GG", nil) + req, _ = http.NewRequest(http.MethodPost, webAdminEventActionPath+"?a=a%C3%A2%GG", nil) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") _, err = getEventActionFromPostFields(req) assert.Error(t, err) - req, _ = http.NewRequest(http.MethodPost, webAdminEventRulePath+"?a=a%C3%AO%GG", nil) + req, _ = http.NewRequest(http.MethodPost, webAdminEventRulePath+"?a=a%C3%A3%GG", nil) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") _, err = getEventRuleFromPostFields(req) assert.Error(t, err) diff --git a/internal/httpd/middleware.go b/internal/httpd/middleware.go index c8381ee1..4e9de1bf 100644 --- a/internal/httpd/middleware.go +++ b/internal/httpd/middleware.go @@ -54,7 +54,7 @@ func validateJWTToken(w http.ResponseWriter, r *http.Request, audience tokenAudi } else { redirectPath = webClientLoginPath if uri := r.RequestURI; strings.HasPrefix(uri, webClientFilesPath) { - redirectPath += "?next=" + url.QueryEscape(uri) + redirectPath += "?next=" + url.QueryEscape(uri) //nolint:goconst } } diff --git a/internal/httpd/oidc_test.go b/internal/httpd/oidc_test.go index 205f362b..52a07429 100644 --- a/internal/httpd/oidc_test.go +++ b/internal/httpd/oidc_test.go @@ -1246,7 +1246,7 @@ func TestOIDCEvMgrIntegration(t *testing.T) { Nonce: authReq.Nonce, Expiry: time.Now().Add(5 * time.Minute), } - setIDTokenClaims(idToken, []byte(`{"preferred_username":"`+util.JSONEscape(username)+`","custom1":{"sub":"val1"},"custom2":"desc"}`)) + setIDTokenClaims(idToken, []byte(`{"preferred_username":"`+util.JSONEscape(username)+`","custom1":{"sub":"val1"},"custom2":"desc"}`)) //nolint:goconst server.binding.OIDC.verifier = &mockOIDCVerifier{ err: nil, token: idToken, diff --git a/internal/httpd/server.go b/internal/httpd/server.go index 14722707..0bfcdb4a 100644 --- a/internal/httpd/server.go +++ b/internal/httpd/server.go @@ -1244,7 +1244,7 @@ func (s *httpdServer) initializeRouter() { if s.enableRESTAPI { // share API available to external users - s.router.Get(sharesPath+"/{id}", s.downloadFromShare) + s.router.Get(sharesPath+"/{id}", s.downloadFromShare) //nolint:goconst s.router.Post(sharesPath+"/{id}", s.uploadFilesToShare) s.router.Post(sharesPath+"/{id}/{name}", s.uploadFileToShare) s.router.With(compressor.Handler).Get(sharesPath+"/{id}/dirs", s.readBrowsableShareContents) @@ -1294,12 +1294,12 @@ func (s *httpdServer) initializeRouter() { router.With(s.checkPerm(dataprovider.PermAdminQuotaScans)).Post(quotasBasePath+"/folders/{name}/scan", startFolderQuotaScan) router.With(s.checkPerm(dataprovider.PermAdminViewUsers)).Get(userPath, getUsers) router.With(s.checkPerm(dataprovider.PermAdminAddUsers)).Post(userPath, addUser) - router.With(s.checkPerm(dataprovider.PermAdminViewUsers)).Get(userPath+"/{username}", getUserByUsername) + router.With(s.checkPerm(dataprovider.PermAdminViewUsers)).Get(userPath+"/{username}", getUserByUsername) //nolint:goconst router.With(s.checkPerm(dataprovider.PermAdminChangeUsers)).Put(userPath+"/{username}", updateUser) router.With(s.checkPerm(dataprovider.PermAdminDeleteUsers)).Delete(userPath+"/{username}", deleteUser) router.With(s.checkPerm(dataprovider.PermAdminChangeUsers)).Put(userPath+"/{username}/2fa/disable", disableUser2FA) router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Get(folderPath, getFolders) - router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Get(folderPath+"/{name}", getFolderByName) + router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Get(folderPath+"/{name}", getFolderByName) //nolint:goconst router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Post(folderPath, addFolder) router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Put(folderPath+"/{name}", updateFolder) router.With(s.checkPerm(dataprovider.PermAdminManageFolders)).Delete(folderPath+"/{name}", deleteFolder) @@ -1364,9 +1364,9 @@ func (s *httpdServer) initializeRouter() { router.With(s.checkPerm(dataprovider.PermAdminManageRoles)).Get(rolesPath+"/{name}", getRoleByName) router.With(s.checkPerm(dataprovider.PermAdminManageRoles)).Put(rolesPath+"/{name}", updateRole) router.With(s.checkPerm(dataprovider.PermAdminManageRoles)).Delete(rolesPath+"/{name}", deleteRole) - router.With(s.checkPerm(dataprovider.PermAdminManageIPLists), compressor.Handler).Get(ipListsPath+"/{type}", getIPListEntries) + router.With(s.checkPerm(dataprovider.PermAdminManageIPLists), compressor.Handler).Get(ipListsPath+"/{type}", getIPListEntries) //nolint:goconst router.With(s.checkPerm(dataprovider.PermAdminManageIPLists)).Post(ipListsPath+"/{type}", addIPListEntry) - router.With(s.checkPerm(dataprovider.PermAdminManageIPLists)).Get(ipListsPath+"/{type}/{ipornet}", getIPListEntry) + router.With(s.checkPerm(dataprovider.PermAdminManageIPLists)).Get(ipListsPath+"/{type}/{ipornet}", getIPListEntry) //nolint:goconst router.With(s.checkPerm(dataprovider.PermAdminManageIPLists)).Put(ipListsPath+"/{type}/{ipornet}", updateIPListEntry) router.With(s.checkPerm(dataprovider.PermAdminManageIPLists)).Delete(ipListsPath+"/{type}/{ipornet}", deleteIPListEntry) }) diff --git a/internal/httpdtest/httpfsimpl.go b/internal/httpdtest/httpfsimpl.go index 4be31202..8c6f3a15 100644 --- a/internal/httpdtest/httpfsimpl.go +++ b/internal/httpdtest/httpfsimpl.go @@ -478,7 +478,7 @@ func (fs *httpFsImpl) configureRouter() { fs.router = chi.NewRouter() fs.router.Use(middleware.Recoverer) - fs.router.Get(statPath+"/{name}", fs.stat) + fs.router.Get(statPath+"/{name}", fs.stat) //nolint:goconst fs.router.Get(openPath+"/{name}", fs.open) fs.router.Post(createPath+"/{name}", fs.create) fs.router.Patch(renamePath+"/{name}", fs.rename) diff --git a/internal/sftpd/cryptfs_test.go b/internal/sftpd/cryptfs_test.go index 805fd131..3ffa818e 100644 --- a/internal/sftpd/cryptfs_test.go +++ b/internal/sftpd/cryptfs_test.go @@ -239,7 +239,7 @@ func TestQuotaFileReplaceCryptFs(t *testing.T) { assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize) // now create a symlink, replace it with a file and check the quota // replacing a symlink is like uploading a new file - err = client.Symlink(testFileName, testFileName+".link") + err = client.Symlink(testFileName, testFileName+".link") //nolint:goconst assert.NoError(t, err) user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK) assert.NoError(t, err) diff --git a/internal/sftpd/sftpd_test.go b/internal/sftpd/sftpd_test.go index 495c84a1..c0e09368 100644 --- a/internal/sftpd/sftpd_test.go +++ b/internal/sftpd/sftpd_test.go @@ -4320,7 +4320,7 @@ func TestQuotaDisabledError(t *testing.T) { assert.NoError(t, err) err = sftpUploadFile(testFilePath, testFileName+"1", testFileSize, client) assert.NoError(t, err) - err = client.Rename(testFileName+"1", testFileName+".rename") + err = client.Rename(testFileName+"1", testFileName+".rename") //nolint:goconst assert.NoError(t, err) err = os.Remove(testFilePath) assert.NoError(t, err) @@ -4580,7 +4580,7 @@ func TestQuotaRename(t *testing.T) { assert.NoError(t, err) assert.Equal(t, 1, user.UsedQuotaFiles) assert.Equal(t, testFileSize1, user.UsedQuotaSize) - err = client.Symlink(testFileName+".rename", testFileName+".symlink") + err = client.Symlink(testFileName+".rename", testFileName+".symlink") //nolint:goconst assert.NoError(t, err) err = sftpUploadFile(testFilePath, testFileName, testFileSize, client) assert.NoError(t, err) @@ -4725,7 +4725,7 @@ func TestQuotaLimits(t *testing.T) { if assert.NoError(t, err) { defer conn.Close() defer client.Close() - err = sftpUploadFile(testFilePath, testFileName+".quota", testFileSize, client) + err = sftpUploadFile(testFilePath, testFileName+".quota", testFileSize, client) //nolint:goconst assert.NoError(t, err) err = sftpUploadFile(testFilePath, testFileName+".quota.1", testFileSize, client) if assert.Error(t, err, "user is over quota files, upload must fail") { @@ -7213,7 +7213,7 @@ func TestVirtualFoldersLink(t *testing.T) { assert.NoError(t, err) err = client.Symlink(path.Join(vdirPath2, testFileName), path.Join(vdirPath2, testDir, testFileName+".link")) assert.NoError(t, err) - err = client.Symlink(path.Join("/", testFileName), path.Join(vdirPath1, testFileName+".link1")) + err = client.Symlink(path.Join("/", testFileName), path.Join(vdirPath1, testFileName+".link1")) //nolint:goconst assert.Error(t, err) err = client.Symlink(path.Join("/", testFileName), path.Join(vdirPath1, testDir, testFileName+".link1")) assert.Error(t, err) @@ -9174,11 +9174,11 @@ func TestSSHCopy(t *testing.T) { assert.Equal(t, 6, user.UsedQuotaFiles) assert.Equal(t, 3*testFileSize+3*testFileSize1, user.UsedQuotaSize) } - out, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", path.Join(vdirPath2, testDir1, testFileName), testFileName+".copy"), + out, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", path.Join(vdirPath2, testDir1, testFileName), testFileName+".copy"), //nolint:goconst user, usePubKey) if assert.NoError(t, err) { assert.Equal(t, "OK\n", string(out)) - fi, err := client.Stat(testFileName + ".copy") + fi, err := client.Stat(testFileName + ".copy") //nolint:goconst if assert.NoError(t, err) { assert.True(t, fi.Mode().IsRegular()) } @@ -9187,7 +9187,7 @@ func TestSSHCopy(t *testing.T) { assert.Equal(t, 7, user.UsedQuotaFiles) assert.Equal(t, 4*testFileSize+3*testFileSize1, user.UsedQuotaSize) } - out, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", path.Join(vdirPath1, testDir1), path.Join(vdirPath2, testDir1+"copy")), + out, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", path.Join(vdirPath1, testDir1), path.Join(vdirPath2, testDir1+"copy")), //nolint:goconst user, usePubKey) if assert.NoError(t, err) { assert.Equal(t, "OK\n", string(out)) @@ -9418,7 +9418,7 @@ func TestSSHCopyQuotaLimits(t *testing.T) { assert.NoError(t, err) // user quota: 2 files, size: 32768*2, folder2 quota: 2 files, size: 32768*2 // try to duplicate testDir, this will result in 4 file (over quota) and 32768*4 bytes (not over quota) - _, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", testDir, testDir+"_copy"), user, usePubKey) + _, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", testDir, testDir+"_copy"), user, usePubKey) //nolint:goconst assert.Error(t, err) _, err = runSSHCommand(fmt.Sprintf("sftpgo-copy %v %v", path.Join(vdirPath2, testDir), path.Join(vdirPath2, testDir+"_copy")), user, usePubKey) diff --git a/internal/util/util.go b/internal/util/util.go index 56526614..41dd34e0 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -54,8 +54,9 @@ import ( ) const ( - logSender = "util" - osWindows = "windows" + logSender = "util" + osWindows = "windows" + pubKeySuffix = ".pub" ) var ( @@ -372,7 +373,7 @@ func GenerateRSAKeys(file string) error { if err != nil { return err } - return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600) + return os.WriteFile(file+pubKeySuffix, ssh.MarshalAuthorizedKey(pub), 0600) } // GenerateECDSAKeys generate ecdsa private and public keys and write the @@ -410,7 +411,7 @@ func GenerateECDSAKeys(file string) error { if err != nil { return err } - return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600) + return os.WriteFile(file+pubKeySuffix, ssh.MarshalAuthorizedKey(pub), 0600) } // GenerateEd25519Keys generate ed25519 private and public keys and write the @@ -442,7 +443,7 @@ func GenerateEd25519Keys(file string) error { if err != nil { return err } - return os.WriteFile(file+".pub", ssh.MarshalAuthorizedKey(pub), 0600) + return os.WriteFile(file+pubKeySuffix, ssh.MarshalAuthorizedKey(pub), 0600) } // IsDirOverlapped returns true if dir1 and dir2 overlap diff --git a/internal/webdavd/webdavd_test.go b/internal/webdavd/webdavd_test.go index bd5b14cf..302cc4b3 100644 --- a/internal/webdavd/webdavd_test.go +++ b/internal/webdavd/webdavd_test.go @@ -608,7 +608,7 @@ func TestBasicHandling(t *testing.T) { files, err := client.ReadDir(testDir) assert.NoError(t, err) assert.Len(t, files, 5) - err = client.Copy(testDir, testDir+"_copy", false) + err = client.Copy(testDir, testDir+"_copy", false) //nolint:goconst assert.NoError(t, err) err = client.RemoveAll(testDir) assert.NoError(t, err) @@ -1909,7 +1909,7 @@ func TestQuotaLimits(t *testing.T) { assert.NoError(t, err) client := getWebDavClient(user, false, nil) // test quota files - err = uploadFileWithRawClient(testFilePath, testFileName+".quota", user.Username, defaultPassword, false, + err = uploadFileWithRawClient(testFilePath, testFileName+".quota", user.Username, defaultPassword, false, //nolint:goconst testFileSize, client) if !assert.NoError(t, err, "username: %v", user.Username) { info, err := os.Stat(testFilePath) @@ -2695,7 +2695,7 @@ func TestMiscCommands(t *testing.T) { assert.NoError(t, err) assert.Equal(t, 6, user.UsedQuotaFiles) assert.Equal(t, 6*testFileSize, user.UsedQuotaSize) - err = client.Copy(dir, dir+"_copy1", false) + err = client.Copy(dir, dir+"_copy1", false) //nolint:goconst assert.NoError(t, err) err = client.Copy(dir+"_copy", dir+"_copy1", false) assert.Error(t, err)