diff --git a/go.mod b/go.mod index e08033b90..888ddd70c 100644 --- a/go.mod +++ b/go.mod @@ -35,8 +35,8 @@ require ( github.com/KimMachineGun/automemlimit v0.7.1 github.com/SherClockHolmes/webpush-go v1.4.0 github.com/buckket/go-blurhash v1.1.0 - github.com/coreos/go-oidc/v3 v3.12.0 - github.com/gin-contrib/cors v1.7.4 + github.com/coreos/go-oidc/v3 v3.14.1 + github.com/gin-contrib/cors v1.7.5 github.com/gin-contrib/gzip v1.2.3 github.com/gin-contrib/sessions v1.0.3 github.com/gin-gonic/gin v1.10.0 @@ -51,9 +51,9 @@ require ( github.com/k3a/html2text v1.2.1 github.com/microcosm-cc/bluemonday v1.0.27 github.com/miekg/dns v1.1.65 - github.com/minio/minio-go/v7 v7.0.89 + github.com/minio/minio-go/v7 v7.0.91 github.com/mitchellh/mapstructure v1.5.0 - github.com/ncruces/go-sqlite3 v0.25.0 + github.com/ncruces/go-sqlite3 v0.25.1 github.com/oklog/ulid v1.3.1 github.com/pquerna/otp v1.4.0 github.com/prometheus/client_golang v1.22.0 @@ -72,25 +72,25 @@ require ( github.com/uptrace/bun/dialect/sqlitedialect v1.2.11 github.com/uptrace/bun/extra/bunotel v1.2.11 github.com/wagslane/go-password-validator v0.3.0 - github.com/yuin/goldmark v1.7.10 + github.com/yuin/goldmark v1.7.11 go.opentelemetry.io/otel v1.35.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 - go.opentelemetry.io/otel/exporters/prometheus v0.56.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 + go.opentelemetry.io/otel/exporters/prometheus v0.57.0 go.opentelemetry.io/otel/metric v1.35.0 go.opentelemetry.io/otel/sdk v1.35.0 - go.opentelemetry.io/otel/sdk/metric v1.34.0 + go.opentelemetry.io/otel/sdk/metric v1.35.0 go.opentelemetry.io/otel/trace v1.35.0 go.uber.org/automaxprocs v1.6.0 golang.org/x/crypto v0.37.0 - golang.org/x/image v0.24.0 + golang.org/x/image v0.26.0 golang.org/x/net v0.39.0 golang.org/x/oauth2 v0.29.0 golang.org/x/sys v0.32.0 golang.org/x/text v0.24.0 gopkg.in/mcuadros/go-syslog.v2 v2.3.0 gopkg.in/yaml.v3 v3.0.1 - modernc.org/sqlite v0.0.0-00010101000000-000000000000 + modernc.org/sqlite v1.37.0 mvdan.cc/xurls/v2 v2.6.0 ) diff --git a/go.sum b/go.sum index 5153bcf3f..23cd10f51 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,8 @@ github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJ github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= -github.com/coreos/go-oidc/v3 v3.12.0 h1:sJk+8G2qq94rDI6ehZ71Bol3oUHy63qNYmkiSjrc/Jo= -github.com/coreos/go-oidc/v3 v3.12.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= +github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk= +github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -133,8 +133,8 @@ github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3G github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/gin-contrib/cors v1.7.4 h1:/fC6/wk7rCRtqKqki8lLr2Xq+hnV49aXDLIuSek9g4k= -github.com/gin-contrib/cors v1.7.4/go.mod h1:vGc/APSgLMlQfEJV5NAzkrAHb0C8DetL3K6QZuvGii0= +github.com/gin-contrib/cors v1.7.5 h1:cXC9SmofOrRg0w9PigwGlHG3ztswH6bqq4vJVXnvYMk= +github.com/gin-contrib/cors v1.7.5/go.mod h1:4q3yi7xBEDDWKapjT2o1V7mScKDDr8k+jZ0fSquGoy0= github.com/gin-contrib/gzip v1.2.3 h1:dAhT722RuEG330ce2agAs75z7yB+NKvX/ZM1r8w0u2U= github.com/gin-contrib/gzip v1.2.3/go.mod h1:ad72i4Bzmaypk8M762gNXa2wkxxjbz0icRNnuLJ9a/c= github.com/gin-contrib/sessions v1.0.3 h1:AZ4j0AalLsGqdrKNbbrKcXx9OJZqViirvNGsJTxcQps= @@ -301,8 +301,8 @@ github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.89 h1:hx4xV5wwTUfyv8LarhJAwNecnXpoTsj9v3f3q/ZkiJU= -github.com/minio/minio-go/v7 v7.0.89/go.mod h1:2rFnGAp02p7Dddo1Fq4S2wYOfpF0MUTSeLTRC90I204= +github.com/minio/minio-go/v7 v7.0.91 h1:tWLZnEfo3OZl5PoXQwcwTAPNNrjyWwOh6cbZitW5JQc= +github.com/minio/minio-go/v7 v7.0.91/go.mod h1:uvMUcGrpgeSAAI6+sD3818508nUyMULw94j2Nxku/Go= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= @@ -322,8 +322,8 @@ github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/ncruces/go-sqlite3 v0.25.0 h1:trugKUs98Zwy9KwRr/EUxZHL92LYt7UqcKqAfpGpK+I= -github.com/ncruces/go-sqlite3 v0.25.0/go.mod h1:n6Z7036yFilJx04yV0mi5JWaF66rUmXn1It9Ux8dx68= +github.com/ncruces/go-sqlite3 v0.25.1 h1:nRK2mZ0jLNFJco8QFZ9+dCXxOGe6Re8bbG5o8gyalr8= +github.com/ncruces/go-sqlite3 v0.25.1/go.mod h1:4BtkHRLbX5hE0PhBxJ11qETTwL7M4lk0ttru9nora1E= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= @@ -483,8 +483,8 @@ github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FB github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.10 h1:S+LrtBjRmqMac2UdtB6yyCEJm+UILZ2fefI4p7o0QpI= -github.com/yuin/goldmark v1.7.10/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +github.com/yuin/goldmark v1.7.11 h1:ZCxLyDMtz0nT2HFfsYG8WZ47Trip2+JyLysKcMYE5bo= +github.com/yuin/goldmark v1.7.11/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround h1:QbfrBqNKgAFSSK89fYf547vxDQuz8p6iJUzzAMrusNk= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ= @@ -497,16 +497,16 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0f go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 h1:BEj3SPM81McUZHYjRS5pEgNgnmzGJ5tRpU5krWnV8Bs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0/go.mod h1:9cKLGBDzI/F3NoHLQGm4ZrYdIHsvGt6ej6hUowxY0J4= -go.opentelemetry.io/otel/exporters/prometheus v0.56.0 h1:GnCIi0QyG0yy2MrJLzVrIM7laaJstj//flf1zEJCG+E= -go.opentelemetry.io/otel/exporters/prometheus v0.56.0/go.mod h1:JQcVZtbIIPM+7SWBB+T6FK+xunlyidwLp++fN0sUaOk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk= +go.opentelemetry.io/otel/exporters/prometheus v0.57.0 h1:AHh/lAP1BHrY5gBwk8ncc25FXWm/gmmY3BX258z5nuk= +go.opentelemetry.io/otel/exporters/prometheus v0.57.0/go.mod h1:QpFWz1QxqevfjwzYdbMb4Y1NnlJvqSGwyuU0B4iuc9c= go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= -go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= -go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= +go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= @@ -530,8 +530,8 @@ golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= -golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= -golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= +golang.org/x/image v0.26.0 h1:4XjIFEZWQmCZi6Wv8BoxsDhRU3RVnLX04dToTDAEPlY= +golang.org/x/image v0.26.0/go.mod h1:lcxbMFAovzpnJxzXS3nyL83K27tmqtKzIJpctK8YO5c= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= diff --git a/vendor/github.com/gin-contrib/cors/.golangci.yml b/vendor/github.com/gin-contrib/cors/.golangci.yml index 67edf0ac8..47094ac61 100644 --- a/vendor/github.com/gin-contrib/cors/.golangci.yml +++ b/vendor/github.com/gin-contrib/cors/.golangci.yml @@ -1,7 +1,6 @@ +version: "2" linters: - enable-all: false - disable-all: true - fast: false + default: none enable: - bodyclose - dogsled @@ -12,11 +11,8 @@ linters: - goconst - gocritic - gocyclo - - gofmt - - goimports - goprintffuncname - gosec - - gosimple - govet - ineffassign - lll @@ -26,13 +22,29 @@ linters: - nolintlint - rowserrcheck - staticcheck - - stylecheck - - typecheck - unconvert - unparam - unused - whitespace + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt - gofumpt - -run: - timeout: 3m + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/vendor/github.com/minio/minio-go/v7/api-append-object.go b/vendor/github.com/minio/minio-go/v7/api-append-object.go new file mode 100644 index 000000000..fca08c373 --- /dev/null +++ b/vendor/github.com/minio/minio-go/v7/api-append-object.go @@ -0,0 +1,226 @@ +/* + * MinIO Go Library for Amazon S3 Compatible Cloud Storage + * Copyright 2015-2025 MinIO, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package minio + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "net/http" + "strconv" + + "github.com/minio/minio-go/v7/pkg/s3utils" +) + +// AppendObjectOptions https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-objects-append.html +type AppendObjectOptions struct { + // Provide a progress reader to indicate the current append() progress. + Progress io.Reader + // ChunkSize indicates the maximum append() size, + // it is useful when you want to control how much data + // per append() you are interested in sending to server + // while keeping the input io.Reader of a longer length. + ChunkSize uint64 + // Aggressively disable sha256 payload, it is automatically + // turned-off for TLS supporting endpoints, useful in benchmarks + // where you are interested in the peak() numbers. + DisableContentSha256 bool + + customHeaders http.Header + checksumType ChecksumType +} + +// Header returns the custom header for AppendObject API +func (opts AppendObjectOptions) Header() (header http.Header) { + header = make(http.Header) + for k, v := range opts.customHeaders { + header[k] = v + } + return header +} + +func (opts *AppendObjectOptions) setWriteOffset(offset int64) { + if len(opts.customHeaders) == 0 { + opts.customHeaders = make(http.Header) + } + opts.customHeaders["x-amz-write-offset-bytes"] = []string{strconv.FormatInt(offset, 10)} +} + +func (opts *AppendObjectOptions) setChecksumParams(info ObjectInfo) { + if len(opts.customHeaders) == 0 { + opts.customHeaders = make(http.Header) + } + fullObject := info.ChecksumMode == ChecksumFullObjectMode.String() + switch { + case info.ChecksumCRC32 != "": + if fullObject { + opts.checksumType = ChecksumFullObjectCRC32 + } + case info.ChecksumCRC32C != "": + if fullObject { + opts.checksumType = ChecksumFullObjectCRC32C + } + case info.ChecksumCRC64NVME != "": + // CRC64NVME only has a full object variant + // so it does not carry any special full object + // modifier + opts.checksumType = ChecksumCRC64NVME + } +} + +func (opts AppendObjectOptions) validate(c *Client) (err error) { + if opts.ChunkSize > maxPartSize { + return errInvalidArgument("Append chunkSize cannot be larger than max part size allowed") + } + switch { + case !c.trailingHeaderSupport: + return errInvalidArgument("AppendObject() requires Client with TrailingHeaders enabled") + case c.overrideSignerType.IsV2(): + return errInvalidArgument("AppendObject() cannot be used with v2 signatures") + case s3utils.IsGoogleEndpoint(*c.endpointURL): + return errInvalidArgument("AppendObject() cannot be used with GCS endpoints") + } + + return nil +} + +// appendObjectDo - executes the append object http operation. +// NOTE: You must have WRITE permissions on a bucket to add an object to it. +func (c *Client) appendObjectDo(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts AppendObjectOptions) (UploadInfo, error) { + // Input validation. + if err := s3utils.CheckValidBucketName(bucketName); err != nil { + return UploadInfo{}, err + } + if err := s3utils.CheckValidObjectName(objectName); err != nil { + return UploadInfo{}, err + } + + // Set headers. + customHeader := opts.Header() + + // Populate request metadata. + reqMetadata := requestMetadata{ + bucketName: bucketName, + objectName: objectName, + customHeader: customHeader, + contentBody: reader, + contentLength: size, + streamSha256: !opts.DisableContentSha256, + } + + if opts.checksumType.IsSet() { + reqMetadata.addCrc = &opts.checksumType + } + + // Execute PUT an objectName. + resp, err := c.executeMethod(ctx, http.MethodPut, reqMetadata) + defer closeResponse(resp) + if err != nil { + return UploadInfo{}, err + } + if resp != nil { + if resp.StatusCode != http.StatusOK { + return UploadInfo{}, httpRespToErrorResponse(resp, bucketName, objectName) + } + } + + h := resp.Header + + // When AppendObject() is used, S3 Express will return final object size as x-amz-object-size + if amzSize := h.Get("x-amz-object-size"); amzSize != "" { + size, err = strconv.ParseInt(amzSize, 10, 64) + if err != nil { + return UploadInfo{}, err + } + } + + return UploadInfo{ + Bucket: bucketName, + Key: objectName, + ETag: trimEtag(h.Get("ETag")), + Size: size, + + // Checksum values + ChecksumCRC32: h.Get(ChecksumCRC32.Key()), + ChecksumCRC32C: h.Get(ChecksumCRC32C.Key()), + ChecksumSHA1: h.Get(ChecksumSHA1.Key()), + ChecksumSHA256: h.Get(ChecksumSHA256.Key()), + ChecksumCRC64NVME: h.Get(ChecksumCRC64NVME.Key()), + ChecksumMode: h.Get(ChecksumFullObjectMode.Key()), + }, nil +} + +// AppendObject - S3 Express Zone https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-objects-append.html +func (c *Client) AppendObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, + opts AppendObjectOptions, +) (info UploadInfo, err error) { + if objectSize < 0 && opts.ChunkSize == 0 { + return UploadInfo{}, errors.New("object size must be provided when no chunk size is provided") + } + + if err = opts.validate(c); err != nil { + return UploadInfo{}, err + } + + oinfo, err := c.StatObject(ctx, bucketName, objectName, StatObjectOptions{Checksum: true}) + if err != nil { + return UploadInfo{}, err + } + if oinfo.ChecksumMode != ChecksumFullObjectMode.String() { + return UploadInfo{}, fmt.Errorf("append API is not allowed on objects that are not full_object checksum type: %s", oinfo.ChecksumMode) + } + opts.setChecksumParams(oinfo) // set the appropriate checksum params based on the existing object checksum metadata. + opts.setWriteOffset(oinfo.Size) // First append must set the current object size as the offset. + + if opts.ChunkSize > 0 { + finalObjSize := int64(-1) + if objectSize > 0 { + finalObjSize = info.Size + objectSize + } + totalPartsCount, partSize, lastPartSize, err := OptimalPartInfo(finalObjSize, opts.ChunkSize) + if err != nil { + return UploadInfo{}, err + } + buf := make([]byte, partSize) + var partNumber int + for partNumber = 1; partNumber <= totalPartsCount; partNumber++ { + // Proceed to upload the part. + if partNumber == totalPartsCount { + partSize = lastPartSize + } + n, err := readFull(reader, buf) + if err != nil { + return info, err + } + if n != int(partSize) { + return info, io.ErrUnexpectedEOF + } + rd := newHook(bytes.NewReader(buf[:n]), opts.Progress) + uinfo, err := c.appendObjectDo(ctx, bucketName, objectName, rd, partSize, opts) + if err != nil { + return info, err + } + opts.setWriteOffset(uinfo.Size) + } + } + + rd := newHook(reader, opts.Progress) + return c.appendObjectDo(ctx, bucketName, objectName, rd, objectSize, opts) +} diff --git a/vendor/github.com/minio/minio-go/v7/api-bucket-notification.go b/vendor/github.com/minio/minio-go/v7/api-bucket-notification.go index 33811b98f..b1e5b0aae 100644 --- a/vendor/github.com/minio/minio-go/v7/api-bucket-notification.go +++ b/vendor/github.com/minio/minio-go/v7/api-bucket-notification.go @@ -157,13 +157,6 @@ func (c *Client) ListenBucketNotification(ctx context.Context, bucketName, prefi return } - // Continuously run and listen on bucket notification. - // Create a done channel to control 'ListObjects' go routine. - retryDoneCh := make(chan struct{}, 1) - - // Indicate to our routine to exit cleanly upon return. - defer close(retryDoneCh) - // Prepare urlValues to pass into the request on every loop urlValues := make(url.Values) urlValues.Set("ping", "10") @@ -172,7 +165,7 @@ func (c *Client) ListenBucketNotification(ctx context.Context, bucketName, prefi urlValues["events"] = events // Wait on the jitter retry loop. - for range c.newRetryTimerContinous(time.Second, time.Second*30, MaxJitter, retryDoneCh) { + for range c.newRetryTimerContinous(time.Second, time.Second*30, MaxJitter) { // Execute GET on bucket to list objects. resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ bucketName: bucketName, diff --git a/vendor/github.com/minio/minio-go/v7/api-datatypes.go b/vendor/github.com/minio/minio-go/v7/api-datatypes.go index 2118c7c77..39ff9d27c 100644 --- a/vendor/github.com/minio/minio-go/v7/api-datatypes.go +++ b/vendor/github.com/minio/minio-go/v7/api-datatypes.go @@ -148,6 +148,7 @@ type UploadInfo struct { ChecksumSHA1 string ChecksumSHA256 string ChecksumCRC64NVME string + ChecksumMode string } // RestoreInfo contains information of the restore operation of an archived object @@ -223,6 +224,7 @@ type ObjectInfo struct { ChecksumSHA1 string ChecksumSHA256 string ChecksumCRC64NVME string + ChecksumMode string Internal *struct { K int // Data blocks diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go index 03bd34f76..84bc19b28 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object-multipart.go @@ -457,5 +457,6 @@ func (c *Client) completeMultipartUpload(ctx context.Context, bucketName, object ChecksumCRC32: completeMultipartUploadResult.ChecksumCRC32, ChecksumCRC32C: completeMultipartUploadResult.ChecksumCRC32C, ChecksumCRC64NVME: completeMultipartUploadResult.ChecksumCRC64NVME, + ChecksumMode: completeMultipartUploadResult.ChecksumType, }, nil } diff --git a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go index 82c0ae9e4..987a3c692 100644 --- a/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go +++ b/vendor/github.com/minio/minio-go/v7/api-put-object-streaming.go @@ -805,5 +805,6 @@ func (c *Client) putObjectDo(ctx context.Context, bucketName, objectName string, ChecksumSHA1: h.Get(ChecksumSHA1.Key()), ChecksumSHA256: h.Get(ChecksumSHA256.Key()), ChecksumCRC64NVME: h.Get(ChecksumCRC64NVME.Key()), + ChecksumMode: h.Get(ChecksumFullObjectMode.Key()), }, nil } diff --git a/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go b/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go index 08a5a7b6e..3204263dc 100644 --- a/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go +++ b/vendor/github.com/minio/minio-go/v7/api-s3-datatypes.go @@ -366,6 +366,7 @@ type completeMultipartUploadResult struct { ChecksumSHA1 string ChecksumSHA256 string ChecksumCRC64NVME string + ChecksumType string } // CompletePart sub container lists individual part numbers and their diff --git a/vendor/github.com/minio/minio-go/v7/api.go b/vendor/github.com/minio/minio-go/v7/api.go index b64f57615..39cd5fd53 100644 --- a/vendor/github.com/minio/minio-go/v7/api.go +++ b/vendor/github.com/minio/minio-go/v7/api.go @@ -155,7 +155,7 @@ type Options struct { // Global constants. const ( libraryName = "minio-go" - libraryVersion = "v7.0.89" + libraryVersion = "v7.0.91" ) // User Agent should always following the below style. @@ -660,13 +660,7 @@ func (c *Client) executeMethod(ctx context.Context, method string, metadata requ metadata.trailer.Set(metadata.addCrc.Key(), base64.StdEncoding.EncodeToString(crc.Sum(nil))) } - // Create cancel context to control 'newRetryTimer' go routine. - retryCtx, cancel := context.WithCancel(ctx) - - // Indicate to our routine to exit cleanly upon return. - defer cancel() - - for range c.newRetryTimer(retryCtx, reqRetry, DefaultRetryUnit, DefaultRetryCap, MaxJitter) { + for range c.newRetryTimer(ctx, reqRetry, DefaultRetryUnit, DefaultRetryCap, MaxJitter) { // Retry executes the following function body if request has an // error until maxRetries have been exhausted, retry attempts are // performed after waiting for a given period of time in a @@ -779,7 +773,7 @@ func (c *Client) executeMethod(ctx context.Context, method string, metadata requ } // Return an error when retry is canceled or deadlined - if e := retryCtx.Err(); e != nil { + if e := ctx.Err(); e != nil { return nil, e } @@ -909,6 +903,11 @@ func (c *Client) newRequest(ctx context.Context, method string, metadata request // For anonymous requests just return. if signerType.IsAnonymous() { + if len(metadata.trailer) > 0 { + req.Header.Set("X-Amz-Content-Sha256", unsignedPayloadTrailer) + return signer.UnsignedTrailer(*req, metadata.trailer), nil + } + return req, nil } @@ -1066,3 +1065,11 @@ func (c *Client) CredContext() *credentials.CredContext { Endpoint: c.endpointURL.String(), } } + +// GetCreds returns the access creds for the client +func (c *Client) GetCreds() (credentials.Value, error) { + if c.credsProvider == nil { + return credentials.Value{}, errors.New("no credentials provider") + } + return c.credsProvider.GetWithContext(c.CredContext()) +} diff --git a/vendor/github.com/minio/minio-go/v7/checksum.go b/vendor/github.com/minio/minio-go/v7/checksum.go index c7456cda2..5c24bf64a 100644 --- a/vendor/github.com/minio/minio-go/v7/checksum.go +++ b/vendor/github.com/minio/minio-go/v7/checksum.go @@ -34,6 +34,43 @@ import ( "github.com/minio/crc64nvme" ) +// ChecksumMode contains information about the checksum mode on the object +type ChecksumMode uint32 + +const ( + // ChecksumFullObjectMode Full object checksum `csumCombine(csum1, csum2...)...), csumN...)` + ChecksumFullObjectMode ChecksumMode = 1 << iota + + // ChecksumCompositeMode Composite checksum `csum([csum1 + csum2 ... + csumN])` + ChecksumCompositeMode + + // Keep after all valid checksums + checksumLastMode + + // checksumModeMask is a mask for valid checksum mode types. + checksumModeMask = checksumLastMode - 1 +) + +// Is returns if c is all of t. +func (c ChecksumMode) Is(t ChecksumMode) bool { + return c&t == t +} + +// Key returns the header key. +func (c ChecksumMode) Key() string { + return amzChecksumMode +} + +func (c ChecksumMode) String() string { + switch c & checksumModeMask { + case ChecksumFullObjectMode: + return "FULL_OBJECT" + case ChecksumCompositeMode: + return "COMPOSITE" + } + return "" +} + // ChecksumType contains information about the checksum type. type ChecksumType uint32 @@ -75,6 +112,7 @@ const ( amzChecksumSHA1 = "x-amz-checksum-sha1" amzChecksumSHA256 = "x-amz-checksum-sha256" amzChecksumCRC64NVME = "x-amz-checksum-crc64nvme" + amzChecksumMode = "x-amz-checksum-type" ) // Base returns the base type, without modifiers. @@ -397,7 +435,7 @@ func addAutoChecksumHeaders(opts *PutObjectOptions) { } opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String() if opts.AutoChecksum.FullObjectRequested() { - opts.UserMetadata["X-Amz-Checksum-Type"] = "FULL_OBJECT" + opts.UserMetadata[amzChecksumMode] = ChecksumFullObjectMode.String() } } @@ -414,7 +452,10 @@ func applyAutoChecksum(opts *PutObjectOptions, allParts []ObjectPart) { } else if opts.AutoChecksum.CanMergeCRC() { crc, err := opts.AutoChecksum.FullObjectChecksum(allParts) if err == nil { - opts.UserMetadata = map[string]string{opts.AutoChecksum.KeyCapitalized(): crc.Encoded(), "X-Amz-Checksum-Type": "FULL_OBJECT"} + opts.UserMetadata = map[string]string{ + opts.AutoChecksum.KeyCapitalized(): crc.Encoded(), + amzChecksumMode: ChecksumFullObjectMode.String(), + } } } } diff --git a/vendor/github.com/minio/minio-go/v7/hook-reader.go b/vendor/github.com/minio/minio-go/v7/hook-reader.go index 07bc7dbcf..61268a104 100644 --- a/vendor/github.com/minio/minio-go/v7/hook-reader.go +++ b/vendor/github.com/minio/minio-go/v7/hook-reader.go @@ -20,7 +20,6 @@ package minio import ( "fmt" "io" - "sync" ) // hookReader hooks additional reader in the source stream. It is @@ -28,7 +27,6 @@ import ( // notified about the exact number of bytes read from the primary // source on each Read operation. type hookReader struct { - mu sync.RWMutex source io.Reader hook io.Reader } @@ -36,9 +34,6 @@ type hookReader struct { // Seek implements io.Seeker. Seeks source first, and if necessary // seeks hook if Seek method is appropriately found. func (hr *hookReader) Seek(offset int64, whence int) (n int64, err error) { - hr.mu.Lock() - defer hr.mu.Unlock() - // Verify for source has embedded Seeker, use it. sourceSeeker, ok := hr.source.(io.Seeker) if ok { @@ -70,9 +65,6 @@ func (hr *hookReader) Seek(offset int64, whence int) (n int64, err error) { // value 'n' number of bytes are reported through the hook. Returns // error for all non io.EOF conditions. func (hr *hookReader) Read(b []byte) (n int, err error) { - hr.mu.RLock() - defer hr.mu.RUnlock() - n, err = hr.source.Read(b) if err != nil && err != io.EOF { return n, err @@ -92,7 +84,7 @@ func (hr *hookReader) Read(b []byte) (n int, err error) { // reports the data read from the source to the hook. func newHook(source, hook io.Reader) io.Reader { if hook == nil { - return &hookReader{source: source} + return source } return &hookReader{ source: source, diff --git a/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v4.go b/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v4.go index 09ece53a0..2842899b9 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v4.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/signer/request-signature-v4.go @@ -333,11 +333,34 @@ func signV4(req http.Request, accessKeyID, secretAccessKey, sessionToken, locati if len(trailer) > 0 { // Use custom chunked encoding. req.Trailer = trailer - return StreamingUnsignedV4(&req, sessionToken, req.ContentLength, time.Now().UTC()) + return StreamingUnsignedV4(&req, sessionToken, req.ContentLength, t) } return &req } +// UnsignedTrailer will do chunked encoding with a custom trailer. +func UnsignedTrailer(req http.Request, trailer http.Header) *http.Request { + if len(trailer) == 0 { + return &req + } + // Initial time. + t := time.Now().UTC() + + // Set x-amz-date. + req.Header.Set("X-Amz-Date", t.Format(iso8601DateFormat)) + + for k := range trailer { + req.Header.Add("X-Amz-Trailer", strings.ToLower(k)) + } + + req.Header.Set("Content-Encoding", "aws-chunked") + req.Header.Set("x-amz-decoded-content-length", strconv.FormatInt(req.ContentLength, 10)) + + // Use custom chunked encoding. + req.Trailer = trailer + return StreamingUnsignedV4(&req, "", req.ContentLength, t) +} + // SignV4 sign the request before Do(), in accordance with // http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html. func SignV4(req http.Request, accessKeyID, secretAccessKey, sessionToken, location string) *http.Request { diff --git a/vendor/github.com/minio/minio-go/v7/retry-continous.go b/vendor/github.com/minio/minio-go/v7/retry-continous.go index 81fcf16f1..21e9fd455 100644 --- a/vendor/github.com/minio/minio-go/v7/retry-continous.go +++ b/vendor/github.com/minio/minio-go/v7/retry-continous.go @@ -17,12 +17,14 @@ package minio -import "time" +import ( + "iter" + "math" + "time" +) // newRetryTimerContinous creates a timer with exponentially increasing delays forever. -func (c *Client) newRetryTimerContinous(baseSleep, maxSleep time.Duration, jitter float64, doneCh chan struct{}) <-chan int { - attemptCh := make(chan int) - +func (c *Client) newRetryTimerContinous(baseSleep, maxSleep time.Duration, jitter float64) iter.Seq[int] { // normalize jitter to the range [0, 1.0] if jitter < NoJitter { jitter = NoJitter @@ -44,26 +46,20 @@ func (c *Client) newRetryTimerContinous(baseSleep, maxSleep time.Duration, jitte if sleep > maxSleep { sleep = maxSleep } - if jitter != NoJitter { + if math.Abs(jitter-NoJitter) > 1e-9 { sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter) } return sleep } - go func() { - defer close(attemptCh) + return func(yield func(int) bool) { var nextBackoff int for { - select { - // Attempts starts. - case attemptCh <- nextBackoff: - nextBackoff++ - case <-doneCh: - // Stop the routine. + if !yield(nextBackoff) { return } + nextBackoff++ time.Sleep(exponentialBackoffWait(nextBackoff)) } - }() - return attemptCh + } } diff --git a/vendor/github.com/minio/minio-go/v7/retry.go b/vendor/github.com/minio/minio-go/v7/retry.go index ed954017c..b83d1b2e5 100644 --- a/vendor/github.com/minio/minio-go/v7/retry.go +++ b/vendor/github.com/minio/minio-go/v7/retry.go @@ -21,6 +21,8 @@ import ( "context" "crypto/x509" "errors" + "iter" + "math" "net/http" "net/url" "time" @@ -45,9 +47,7 @@ var DefaultRetryCap = time.Second // newRetryTimer creates a timer with exponentially increasing // delays until the maximum retry attempts are reached. -func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, maxSleep time.Duration, jitter float64) <-chan int { - attemptCh := make(chan int) - +func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, maxSleep time.Duration, jitter float64) iter.Seq[int] { // computes the exponential backoff duration according to // https://www.awsarchitectureblog.com/2015/03/backoff.html exponentialBackoffWait := func(attempt int) time.Duration { @@ -64,18 +64,22 @@ func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, max if sleep > maxSleep { sleep = maxSleep } - if jitter != NoJitter { + if math.Abs(jitter-NoJitter) > 1e-9 { sleep -= time.Duration(c.random.Float64() * float64(sleep) * jitter) } return sleep } - go func() { - defer close(attemptCh) - for i := 0; i < maxRetry; i++ { - select { - case attemptCh <- i + 1: - case <-ctx.Done(): + return func(yield func(int) bool) { + // if context is already canceled, skip yield + select { + case <-ctx.Done(): + return + default: + } + + for i := range maxRetry { + if !yield(i) { return } @@ -85,8 +89,7 @@ func (c *Client) newRetryTimer(ctx context.Context, maxRetry int, baseSleep, max return } } - }() - return attemptCh + } } // List of AWS S3 error codes which are retryable. diff --git a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go index baab23e96..6928b8eb3 100644 --- a/vendor/github.com/minio/minio-go/v7/s3-endpoints.go +++ b/vendor/github.com/minio/minio-go/v7/s3-endpoints.go @@ -168,6 +168,18 @@ var awsS3EndpointMap = map[string]awsS3Endpoint{ "s3.il-central-1.amazonaws.com", "s3.dualstack.il-central-1.amazonaws.com", }, + "ap-southeast-5": { + "s3.ap-southeast-5.amazonaws.com", + "s3.dualstack.ap-southeast-5.amazonaws.com", + }, + "ap-southeast-7": { + "s3.ap-southeast-7.amazonaws.com", + "s3.dualstack.ap-southeast-7.amazonaws.com", + }, + "mx-central-1": { + "s3.mx-central-1.amazonaws.com", + "s3.dualstack.mx-central-1.amazonaws.com", + }, } // getS3Endpoint get Amazon S3 endpoint based on the bucket location. diff --git a/vendor/github.com/minio/minio-go/v7/utils.go b/vendor/github.com/minio/minio-go/v7/utils.go index 027bb6ce3..6024bfa5b 100644 --- a/vendor/github.com/minio/minio-go/v7/utils.go +++ b/vendor/github.com/minio/minio-go/v7/utils.go @@ -390,6 +390,7 @@ func ToObjectInfo(bucketName, objectName string, h http.Header) (ObjectInfo, err ChecksumSHA1: h.Get(ChecksumSHA1.Key()), ChecksumSHA256: h.Get(ChecksumSHA256.Key()), ChecksumCRC64NVME: h.Get(ChecksumCRC64NVME.Key()), + ChecksumMode: h.Get(ChecksumFullObjectMode.Key()), }, nil } diff --git a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go index 9250cf39d..f473220c0 100644 --- a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go +++ b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go @@ -241,8 +241,9 @@ func (n *connector) Connect(ctx context.Context) (ret driver.Conn, err error) { } }() - old := c.Conn.SetInterrupt(ctx) - defer c.Conn.SetInterrupt(old) + if old := c.Conn.SetInterrupt(ctx); old != ctx { + defer c.Conn.SetInterrupt(old) + } if !n.pragmas { err = c.Conn.BusyTimeout(time.Minute) @@ -362,8 +363,9 @@ func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e c.txReset = `; PRAGMA query_only=` + string(c.readOnly) } - old := c.Conn.SetInterrupt(ctx) - defer c.Conn.SetInterrupt(old) + if old := c.Conn.SetInterrupt(ctx); old != ctx { + defer c.Conn.SetInterrupt(old) + } err := c.Conn.Exec(txBegin) if err != nil { @@ -382,8 +384,10 @@ func (c *conn) Commit() error { func (c *conn) Rollback() error { // ROLLBACK even if interrupted. - old := c.Conn.SetInterrupt(context.Background()) - defer c.Conn.SetInterrupt(old) + ctx := context.Background() + if old := c.Conn.SetInterrupt(ctx); old != ctx { + defer c.Conn.SetInterrupt(old) + } return c.Conn.Exec(`ROLLBACK` + c.txReset) } @@ -393,8 +397,9 @@ func (c *conn) Prepare(query string) (driver.Stmt, error) { } func (c *conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { - old := c.Conn.SetInterrupt(ctx) - defer c.Conn.SetInterrupt(old) + if old := c.Conn.SetInterrupt(ctx); old != ctx { + defer c.Conn.SetInterrupt(old) + } s, tail, err := c.Conn.Prepare(query) if err != nil { @@ -419,8 +424,9 @@ func (c *conn) ExecContext(ctx context.Context, query string, args []driver.Name return resultRowsAffected(0), nil } - old := c.Conn.SetInterrupt(ctx) - defer c.Conn.SetInterrupt(old) + if old := c.Conn.SetInterrupt(ctx); old != ctx { + defer c.Conn.SetInterrupt(old) + } err := c.Conn.Exec(query) if err != nil { @@ -483,8 +489,10 @@ func (s *stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (drive return nil, err } - old := s.Stmt.Conn().SetInterrupt(ctx) - defer s.Stmt.Conn().SetInterrupt(old) + c := s.Stmt.Conn() + if old := c.SetInterrupt(ctx); old != ctx { + defer c.SetInterrupt(old) + } err = errors.Join( s.Stmt.Exec(), @@ -493,7 +501,7 @@ func (s *stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (drive return nil, err } - return newResult(s.Stmt.Conn()), nil + return newResult(c), nil } func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { @@ -678,13 +686,14 @@ func (r *rows) scanType(index int) scantype { func (r *rows) loadColumnMetadata() { if r.nulls == nil { + c := r.Stmt.Conn() count := r.Stmt.ColumnCount() nulls := make([]bool, count) types := make([]string, count) scans := make([]scantype, count) for i := range nulls { if col := r.Stmt.ColumnOriginName(i); col != "" { - types[i], _, nulls[i], _, _, _ = r.Stmt.Conn().TableColumnMetadata( + types[i], _, nulls[i], _, _, _ = c.TableColumnMetadata( r.Stmt.ColumnDatabaseName(i), r.Stmt.ColumnTableName(i), col) @@ -762,8 +771,10 @@ func (r *rows) ColumnTypeScanType(index int) (typ reflect.Type) { } func (r *rows) Next(dest []driver.Value) error { - old := r.Stmt.Conn().SetInterrupt(r.ctx) - defer r.Stmt.Conn().SetInterrupt(old) + c := r.Stmt.Conn() + if old := c.SetInterrupt(r.ctx); old != r.ctx { + defer c.SetInterrupt(old) + } if !r.Stmt.Step() { if err := r.Stmt.Err(); err != nil { diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh index a6b21d366..88e12be31 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh +++ b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh @@ -12,7 +12,7 @@ trap 'rm -f sqlite3.tmp' EXIT "$WASI_SDK/clang" --target=wasm32-wasi -std=c23 -g0 -O2 \ -Wall -Wextra -Wno-unused-parameter -Wno-unused-function \ -o sqlite3.wasm "$ROOT/sqlite3/main.c" \ - -I"$ROOT/sqlite3" \ + -I"$ROOT/sqlite3/libc" -I"$ROOT/sqlite3" \ -mexec-model=reactor \ -msimd128 -mmutable-globals -mmultivalue \ -mbulk-memory -mreference-types \ @@ -27,7 +27,7 @@ trap 'rm -f sqlite3.tmp' EXIT "$BINARYEN/wasm-ctor-eval" -g -c _initialize sqlite3.wasm -o sqlite3.tmp "$BINARYEN/wasm-opt" -g --strip --strip-producers -c -O3 \ - sqlite3.tmp -o sqlite3.wasm \ + sqlite3.tmp -o sqlite3.wasm --low-memory-unused \ --enable-simd --enable-mutable-globals --enable-multivalue \ --enable-bulk-memory --enable-reference-types \ --enable-nontrapping-float-to-int --enable-sign-ext \ No newline at end of file diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt index 84d6102b8..1de4b3382 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt +++ b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt @@ -66,6 +66,7 @@ sqlite3_errmsg sqlite3_error_offset sqlite3_errstr sqlite3_exec +sqlite3_exec_go sqlite3_expanded_sql sqlite3_file_control sqlite3_filename_database diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm index 713fc0675..88ebe9932 100644 Binary files a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm and b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm differ diff --git a/vendor/github.com/ncruces/go-sqlite3/error.go b/vendor/github.com/ncruces/go-sqlite3/error.go index 59982eafd..83b057d0d 100644 --- a/vendor/github.com/ncruces/go-sqlite3/error.go +++ b/vendor/github.com/ncruces/go-sqlite3/error.go @@ -75,7 +75,7 @@ func (e *Error) As(err any) bool { // Temporary returns true for [BUSY] errors. func (e *Error) Temporary() bool { - return e.Code() == BUSY + return e.Code() == BUSY || e.Code() == INTERRUPT } // Timeout returns true for [BUSY_TIMEOUT] errors. diff --git a/vendor/github.com/ncruces/go-sqlite3/stmt.go b/vendor/github.com/ncruces/go-sqlite3/stmt.go index 1ea726ea1..7fa2a504d 100644 --- a/vendor/github.com/ncruces/go-sqlite3/stmt.go +++ b/vendor/github.com/ncruces/go-sqlite3/stmt.go @@ -110,10 +110,7 @@ func (s *Stmt) Step() bool { s.err = INTERRUPT return false } - return s.step() -} -func (s *Stmt) step() bool { rc := res_t(s.c.call("sqlite3_step", stk_t(s.handle))) switch rc { case _ROW: @@ -141,10 +138,9 @@ func (s *Stmt) Exec() error { if s.c.interrupt.Err() != nil { return INTERRUPT } - // TODO: implement this in C. - for s.step() { - } - return s.Reset() + rc := res_t(s.c.call("sqlite3_exec_go", stk_t(s.handle))) + s.err = nil + return s.c.error(rc) } // Status monitors the performance characteristics of prepared statements. @@ -649,6 +645,7 @@ func (s *Stmt) ColumnValue(col int) Value { // [FLOAT] as float64, [NULL] as nil, // [TEXT] as string, and [BLOB] as []byte. func (s *Stmt) Columns(dest ...any) error { + defer s.c.arena.mark()() types, ptr, err := s.columns(int64(len(dest))) if err != nil { return err @@ -701,6 +698,7 @@ func (s *Stmt) Columns(dest ...any) error { // Any []byte are owned by SQLite and may be invalidated by // subsequent calls to [Stmt] methods. func (s *Stmt) ColumnsRaw(dest ...any) error { + defer s.c.arena.mark()() types, ptr, err := s.columns(int64(len(dest))) if err != nil { return err @@ -739,7 +737,6 @@ func (s *Stmt) ColumnsRaw(dest ...any) error { } func (s *Stmt) columns(count int64) ([]byte, ptr_t, error) { - defer s.c.arena.mark()() typePtr := s.c.arena.new(count) dataPtr := s.c.arena.new(count * 8) diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm index 4d3357ea1..fa8af14a0 100644 Binary files a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm and b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm differ diff --git a/vendor/github.com/yuin/goldmark/ast/block.go b/vendor/github.com/yuin/goldmark/ast/block.go index eae7acdca..d17564a99 100644 --- a/vendor/github.com/yuin/goldmark/ast/block.go +++ b/vendor/github.com/yuin/goldmark/ast/block.go @@ -515,6 +515,7 @@ func (n *HTMLBlock) Dump(source []byte, level int) { cl := n.ClosureLine fmt.Printf("%sClosure: \"%s\"\n", indent2, string(cl.Value(source))) } + fmt.Printf("%sHasBlankPreviousLines: %v\n", indent2, n.HasBlankPreviousLines()) fmt.Printf("%s}\n", indent) } diff --git a/vendor/github.com/yuin/goldmark/parser/parser.go b/vendor/github.com/yuin/goldmark/parser/parser.go index b05db1356..7ec40b31a 100644 --- a/vendor/github.com/yuin/goldmark/parser/parser.go +++ b/vendor/github.com/yuin/goldmark/parser/parser.go @@ -1096,7 +1096,7 @@ func (p *parser) parseBlocks(parent ast.Node, reader text.Reader, pc Context) { // When current node is a container block and has no children, // we try to open new child nodes if state&HasChildren != 0 && i == lastIndex { - isBlank = isBlankLine(lineNum-1, i, blankLines) + isBlank = isBlankLine(lineNum-1, i+1, blankLines) p.openBlocks(be.Node, isBlank, reader, pc) break } diff --git a/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go index 50c95a16f..a8677e93a 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go @@ -96,7 +96,7 @@ type collector struct { // prometheus counters MUST have a _total suffix by default: // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/compatibility/prometheus_and_openmetrics.md -const counterSuffix = "_total" +const counterSuffix = "total" // New returns a Prometheus Exporter. func New(opts ...Option) (*Exporter, error) { @@ -368,38 +368,38 @@ func createScopeInfoMetric(scope instrumentation.Scope) (prometheus.Metric, erro var unitSuffixes = map[string]string{ // Time - "d": "_days", - "h": "_hours", - "min": "_minutes", - "s": "_seconds", - "ms": "_milliseconds", - "us": "_microseconds", - "ns": "_nanoseconds", + "d": "days", + "h": "hours", + "min": "minutes", + "s": "seconds", + "ms": "milliseconds", + "us": "microseconds", + "ns": "nanoseconds", // Bytes - "By": "_bytes", - "KiBy": "_kibibytes", - "MiBy": "_mebibytes", - "GiBy": "_gibibytes", - "TiBy": "_tibibytes", - "KBy": "_kilobytes", - "MBy": "_megabytes", - "GBy": "_gigabytes", - "TBy": "_terabytes", + "By": "bytes", + "KiBy": "kibibytes", + "MiBy": "mebibytes", + "GiBy": "gibibytes", + "TiBy": "tibibytes", + "KBy": "kilobytes", + "MBy": "megabytes", + "GBy": "gigabytes", + "TBy": "terabytes", // SI - "m": "_meters", - "V": "_volts", - "A": "_amperes", - "J": "_joules", - "W": "_watts", - "g": "_grams", + "m": "meters", + "V": "volts", + "A": "amperes", + "J": "joules", + "W": "watts", + "g": "grams", // Misc - "Cel": "_celsius", - "Hz": "_hertz", - "1": "_ratio", - "%": "_percent", + "Cel": "celsius", + "Hz": "hertz", + "1": "ratio", + "%": "percent", } // getName returns the sanitized name, prefixed with the namespace and suffixed with unit. @@ -414,19 +414,31 @@ func (c *collector) getName(m metricdata.Metrics, typ *dto.MetricType) string { // Remove the _total suffix here, as we will re-add the total suffix // later, and it needs to come after the unit suffix. name = strings.TrimSuffix(name, counterSuffix) + // If the last character is an underscore, or would be converted to an underscore, trim it from the name. + // an underscore will be added back in later. + if convertsToUnderscore(rune(name[len(name)-1])) { + name = name[:len(name)-1] + } } if c.namespace != "" { name = c.namespace + name } if suffix, ok := unitSuffixes[m.Unit]; ok && !c.withoutUnits && !strings.HasSuffix(name, suffix) { - name += suffix + name += "_" + suffix } if addCounterSuffix { - name += counterSuffix + name += "_" + counterSuffix } return name } +// convertsToUnderscore returns true if the character would be converted to an +// underscore when the escaping scheme is underscore escaping. This is meant to +// capture any character that should be considered a "delimiter". +func convertsToUnderscore(b rune) bool { + return !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == ':' || (b >= '0' && b <= '9')) +} + func (c *collector) metricType(m metricdata.Metrics) *dto.MetricType { switch v := m.Data.(type) { case metricdata.Histogram[int64], metricdata.Histogram[float64]: diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go index 336ea91d1..32a62e1b8 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go @@ -48,7 +48,7 @@ type expoHistogramDataPoint[N int64 | float64] struct { zeroCount uint64 } -func newExpoHistogramDataPoint[N int64 | float64](attrs attribute.Set, maxSize int, maxScale int32, noMinMax, noSum bool) *expoHistogramDataPoint[N] { +func newExpoHistogramDataPoint[N int64 | float64](attrs attribute.Set, maxSize int, maxScale int32, noMinMax, noSum bool) *expoHistogramDataPoint[N] { // nolint:revive // we need this control flag f := math.MaxFloat64 ma := N(f) // if N is int64, max will overflow to -9223372036854775808 mi := N(-f) diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go index 7c4b8530d..92d2589da 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go @@ -5,5 +5,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.34.0" + return "1.35.0" } diff --git a/vendor/golang.org/x/image/webp/decode.go b/vendor/golang.org/x/image/webp/decode.go index e211c7d57..0df3c67e8 100644 --- a/vendor/golang.org/x/image/webp/decode.go +++ b/vendor/golang.org/x/image/webp/decode.go @@ -261,7 +261,7 @@ func Decode(r io.Reader) (image.Image, error) { if err != nil { return nil, err } - return m, err + return m, nil } // DecodeConfig returns the color model and dimensions of a WEBP image without diff --git a/vendor/modules.txt b/vendor/modules.txt index 3824b0a5c..5c14ceb3c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -371,8 +371,8 @@ github.com/cloudwego/base64x/internal/native github.com/cloudwego/base64x/internal/native/avx2 github.com/cloudwego/base64x/internal/native/sse github.com/cloudwego/base64x/internal/rt -# github.com/coreos/go-oidc/v3 v3.12.0 -## explicit; go 1.21 +# github.com/coreos/go-oidc/v3 v3.14.1 +## explicit; go 1.23.0 github.com/coreos/go-oidc/v3/oidc # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit @@ -411,7 +411,7 @@ github.com/gabriel-vasile/mimetype github.com/gabriel-vasile/mimetype/internal/charset github.com/gabriel-vasile/mimetype/internal/json github.com/gabriel-vasile/mimetype/internal/magic -# github.com/gin-contrib/cors v1.7.4 +# github.com/gin-contrib/cors v1.7.5 ## explicit; go 1.23.0 github.com/gin-contrib/cors # github.com/gin-contrib/gzip v1.2.3 @@ -672,7 +672,7 @@ github.com/minio/crc64nvme # github.com/minio/md5-simd v1.1.2 ## explicit; go 1.14 github.com/minio/md5-simd -# github.com/minio/minio-go/v7 v7.0.89 +# github.com/minio/minio-go/v7 v7.0.91 ## explicit; go 1.23.0 github.com/minio/minio-go/v7 github.com/minio/minio-go/v7/pkg/cors @@ -704,7 +704,7 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/ncruces/go-sqlite3 v0.25.0 +# github.com/ncruces/go-sqlite3 v0.25.1 ## explicit; go 1.23.0 github.com/ncruces/go-sqlite3 github.com/ncruces/go-sqlite3/driver @@ -954,7 +954,7 @@ github.com/vmihailenco/tagparser/v2/internal/parser # github.com/wagslane/go-password-validator v0.3.0 ## explicit; go 1.16 github.com/wagslane/go-password-validator -# github.com/yuin/goldmark v1.7.10 +# github.com/yuin/goldmark v1.7.11 ## explicit; go 1.22 github.com/yuin/goldmark github.com/yuin/goldmark/ast @@ -1009,14 +1009,14 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 ## explicit; go 1.22.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry -# go.opentelemetry.io/otel/exporters/prometheus v0.56.0 +# go.opentelemetry.io/otel/exporters/prometheus v0.57.0 ## explicit; go 1.22.0 go.opentelemetry.io/otel/exporters/prometheus # go.opentelemetry.io/otel/metric v1.35.0 @@ -1032,7 +1032,7 @@ go.opentelemetry.io/otel/sdk/internal/env go.opentelemetry.io/otel/sdk/internal/x go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace -# go.opentelemetry.io/otel/sdk/metric v1.34.0 +# go.opentelemetry.io/otel/sdk/metric v1.35.0 ## explicit; go 1.22.0 go.opentelemetry.io/otel/sdk/metric go.opentelemetry.io/otel/sdk/metric/exemplar @@ -1087,8 +1087,8 @@ golang.org/x/crypto/ssh/internal/bcrypt_pbkdf # golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 ## explicit; go 1.23.0 golang.org/x/exp/constraints -# golang.org/x/image v0.24.0 -## explicit; go 1.18 +# golang.org/x/image v0.26.0 +## explicit; go 1.23.0 golang.org/x/image/riff golang.org/x/image/vp8 golang.org/x/image/vp8l @@ -1334,7 +1334,7 @@ modernc.org/mathutil # modernc.org/memory v1.9.1 ## explicit; go 1.23.0 modernc.org/memory -# modernc.org/sqlite v0.0.0-00010101000000-000000000000 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround +# modernc.org/sqlite v1.37.0 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround ## explicit; go 1.23.0 modernc.org/sqlite modernc.org/sqlite/lib