From 917da24555fab214775d6ec54a048b31a95b25d8 Mon Sep 17 00:00:00 2001 From: Vincent Boutour Date: Sun, 19 Mar 2023 11:29:15 +0100 Subject: [PATCH] chore(deps): Bumping absto and httputils Signed-off-by: Vincent Boutour --- cmd/fibr/client.go | 13 ++++++++++--- go.mod | 8 +++++--- go.sum | 32 ++++++++++++++++++++++++++------ pkg/crud/upload_chunk.go | 8 +++----- pkg/metadata/amqp.go | 2 +- pkg/mocks/redis_client.go | 12 ++++++++++++ pkg/thumbnail/amqp.go | 2 +- 7 files changed, 58 insertions(+), 19 deletions(-) diff --git a/cmd/fibr/client.go b/cmd/fibr/client.go index 51dc0876..9a4a2b52 100644 --- a/cmd/fibr/client.go +++ b/cmd/fibr/client.go @@ -24,8 +24,10 @@ type client struct { } func newClient(ctx context.Context, config configuration) (client, error) { - var output client - var err error + var ( + output client + err error + ) output.logger = logger.New(config.logger) logger.Global(output.logger) @@ -39,7 +41,11 @@ func newClient(ctx context.Context, config configuration) (client, error) { output.prometheus = prometheus.New(config.prometheus) output.health = health.New(config.health) - output.redis = redis.New(config.redis, output.tracer.GetTracer("redis")) + + output.redis, err = redis.New(config.redis, output.tracer.GetProvider()) + if err != nil { + return output, fmt.Errorf("redis: %w", err) + } output.amqp, err = amqp.New(config.amqp, output.prometheus.Registerer(), output.tracer.GetTracer("amqp")) if err != nil && !errors.Is(err, amqp.ErrNoConfig) { @@ -51,6 +57,7 @@ func newClient(ctx context.Context, config configuration) (client, error) { func (c client) Close(ctx context.Context) { c.amqp.Close() + c.redis.Close() c.tracer.Close(ctx) c.logger.Close() } diff --git a/go.mod b/go.mod index 2c0e44eb..ded16234 100644 --- a/go.mod +++ b/go.mod @@ -4,16 +4,16 @@ go 1.20 require ( github.com/ViBiOh/ChatPotte v0.2.29 - github.com/ViBiOh/absto v1.4.0 + github.com/ViBiOh/absto v1.4.1 github.com/ViBiOh/auth/v2 v2.14.23 github.com/ViBiOh/exas v0.6.0 github.com/ViBiOh/flags v1.2.0 - github.com/ViBiOh/httputils/v4 v4.54.4 + github.com/ViBiOh/httputils/v4 v4.55.0 github.com/ViBiOh/vith v0.5.10 github.com/golang/mock v1.6.0 github.com/prometheus/client_golang v1.14.0 + github.com/rabbitmq/amqp091-go v1.7.0 github.com/redis/go-redis/v9 v9.0.2 - github.com/streadway/amqp v1.0.0 go.opentelemetry.io/otel v1.14.0 go.opentelemetry.io/otel/trace v1.14.0 golang.org/x/crypto v0.7.0 @@ -44,6 +44,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect + github.com/redis/go-redis/extra/rediscmd/v9 v9.0.2 // indirect + github.com/redis/go-redis/extra/redisotel/v9 v9.0.2 // indirect github.com/rs/xid v1.4.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/tdewolff/minify/v2 v2.12.5 // indirect diff --git a/go.sum b/go.sum index 6ee0c3b7..807455b7 100644 --- a/go.sum +++ b/go.sum @@ -36,23 +36,25 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ViBiOh/ChatPotte v0.2.29 h1:8cIZDvkTfKOC4bZaQkxyOM47BcXZQR8ykJPl9LsZpMM= github.com/ViBiOh/ChatPotte v0.2.29/go.mod h1:GXEpgMQkN0R3CHpqVbuMhS8F6U1S/Qb7qQJ2juFqTtc= -github.com/ViBiOh/absto v1.4.0 h1:fXaP7CbgQ/cJAfKM8Ksc6IlXkjWn6Dz6n9U6KHaQ5WA= -github.com/ViBiOh/absto v1.4.0/go.mod h1:PInUcncKy3FVbFkh2j2IvYJ906JS7HRMUEq+dArLSnw= +github.com/ViBiOh/absto v1.4.1 h1:GW0K8pv3esKmLf/DOtXgVXvvd/oSMp9KW9+XY4iTG2Y= +github.com/ViBiOh/absto v1.4.1/go.mod h1:PInUcncKy3FVbFkh2j2IvYJ906JS7HRMUEq+dArLSnw= github.com/ViBiOh/auth/v2 v2.14.23 h1:ZeQ2/tsh4Z3Jcu/y9R4X05uyhBUJeUC6UN8XyaKJ2s4= github.com/ViBiOh/auth/v2 v2.14.23/go.mod h1:pIMuBueO3sknvnvfAFJBOxTjoGWuxke6lp1ZSh6478w= github.com/ViBiOh/exas v0.6.0 h1:UWQuzesHShBSMkQw7mWAj4NBwL1Hb/fDcgzk/UpacYQ= github.com/ViBiOh/exas v0.6.0/go.mod h1:w6aibKNptsqVwIIIeuifr/1JM551/idiiKhHgDzf7sk= github.com/ViBiOh/flags v1.2.0 h1:DaujjNXzD29KxKyp4eZdn7c9+uBN5DokWgDAe7DcUmc= github.com/ViBiOh/flags v1.2.0/go.mod h1:UyMB5zeD/aId7Xw3x7577ZNU298JmukzOcV8p/H2W1s= -github.com/ViBiOh/httputils/v4 v4.54.4 h1:4ye0S38sX28Cl0BIKkmL98V8wQPVqSOeSp+GdtP7LVk= -github.com/ViBiOh/httputils/v4 v4.54.4/go.mod h1:nyS4SZ/TyVjwqsNUIlMVQybUSWjM0u47yX8+ueBQtUA= +github.com/ViBiOh/httputils/v4 v4.55.0 h1:VXqd/7Fb4yHQ5Jr3/hOT7ZO41lP5olGgfjTLdWpvv+k= +github.com/ViBiOh/httputils/v4 v4.55.0/go.mod h1:QbjM5iotAbmvOsXY1HpCYMs5A8AEFdSRH6FCYrf0O4E= github.com/ViBiOh/vith v0.5.10 h1:BriyDGDFmBRpJpbQhsFxIlq2bT9HmuJ/q903Y+0w0S0= github.com/ViBiOh/vith v0.5.10/go.mod h1:JcGIWVjvXA0zYHz/picn+xMIdk7ljbYjDp7d16BufzM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bsm/ginkgo/v2 v2.5.0 h1:aOAnND1T40wEdAtkGSkvSICWeQ8L3UASX7YVCqQx+eQ= +github.com/bsm/ginkgo/v2 v2.5.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/gomega v1.20.0 h1:JhAwLmtRzXFTx2AkALSLa8ijZafntmhSoU63Ok18Uq8= +github.com/bsm/gomega v1.20.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk= github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -144,6 +146,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -209,6 +212,12 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/rabbitmq/amqp091-go v1.7.0 h1:V5CF5qPem5OGSnEo8BoSbsDGwejg6VUJsKEdneaoTUo= +github.com/rabbitmq/amqp091-go v1.7.0/go.mod h1:wfClAtY0C7bOHxd3GjmF26jEHn+rR/0B3+YV+Vn9/NI= +github.com/redis/go-redis/extra/rediscmd/v9 v9.0.2 h1:RImcxeEeyrbUSm8vE/CGwrBVfaHoWw67n12tv4uXTJw= +github.com/redis/go-redis/extra/rediscmd/v9 v9.0.2/go.mod h1:Q8gKWKQVtBG6qkzIozBCE4ZPtuWtr2NTHZbcBf0UIfo= +github.com/redis/go-redis/extra/redisotel/v9 v9.0.2 h1:M7X7ZJFESh919eIhL8Rj8fNVlY9LGcsIpE+jFZMyblw= +github.com/redis/go-redis/extra/redisotel/v9 v9.0.2/go.mod h1:/uqUz3T+1j2U4Z+hVlN00KI5dluwXY0JzthPxDhjjj4= github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE= github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -219,13 +228,16 @@ github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0 github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= -github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/tdewolff/minify/v2 v2.12.5 h1:s2KDBt/D/3ayE3gcqQF8VIgTmYgkx+btuLvVAeePzZM= github.com/tdewolff/minify/v2 v2.12.5/go.mod h1:i8QXtVyL7Ddwc4I5gqzvgBqKlTMgMNTbiXaPO4Iqg+A= @@ -247,6 +259,7 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 h1:lE9EJyw3/JhrjWH/hEy9FptnalDQgj7vpbgC2KCCCxE= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0/go.mod h1:pcQ3MM3SWvrA71U4GDqv9UFDJ3HQsW7y5ZO3tDTlUdI= +go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= @@ -255,15 +268,19 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCB go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= +go.opentelemetry.io/otel/metric v0.35.0/go.mod h1:qAcbhaTRFU6uG8QM7dDo7XvFsWcugziq/5YI065TokQ= go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs= go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s= +go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE= go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -378,6 +395,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -435,6 +453,7 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -536,6 +555,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/crud/upload_chunk.go b/pkg/crud/upload_chunk.go index 9b49f727..e5cabf50 100644 --- a/pkg/crud/upload_chunk.go +++ b/pkg/crud/upload_chunk.go @@ -9,8 +9,8 @@ import ( "net/http" "os" "path/filepath" - "strings" + absto "github.com/ViBiOh/absto/pkg/model" "github.com/ViBiOh/fibr/pkg/provider" "github.com/ViBiOh/httputils/v4/pkg/cntxt" "github.com/ViBiOh/httputils/v4/pkg/logger" @@ -19,8 +19,6 @@ import ( "github.com/ViBiOh/httputils/v4/pkg/tracer" ) -var ErrRelativePath = errors.New("forbidden relative path") - func (a App) uploadChunk(w http.ResponseWriter, r *http.Request, request provider.Request, fileName, chunkNumber string, file io.Reader) { if file == nil { a.error(w, r, request, model.WrapInvalid(errors.New("no file provided for save"))) @@ -182,8 +180,8 @@ func browseChunkFiles(directory, destination string, writer io.Writer) error { } func safeFilename(fileName string) (string, error) { - if strings.Contains(fileName, "..") { - return fileName, ErrRelativePath + if err := absto.CheckRelativePath(fileName); err != nil { + return fileName, err } output, err := provider.SanitizeName(fileName, true) diff --git a/pkg/metadata/amqp.go b/pkg/metadata/amqp.go index 4b11c37b..20af9ce3 100644 --- a/pkg/metadata/amqp.go +++ b/pkg/metadata/amqp.go @@ -8,7 +8,7 @@ import ( "github.com/ViBiOh/fibr/pkg/provider" "github.com/ViBiOh/httputils/v4/pkg/logger" "github.com/ViBiOh/httputils/v4/pkg/tracer" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func (a App) AMQPHandler(ctx context.Context, message amqp.Delivery) error { diff --git a/pkg/mocks/redis_client.go b/pkg/mocks/redis_client.go index 7b8849b4..0591dcf8 100644 --- a/pkg/mocks/redis_client.go +++ b/pkg/mocks/redis_client.go @@ -36,6 +36,18 @@ func (m *RedisClient) EXPECT() *RedisClientMockRecorder { return m.recorder } +// Close mocks base method. +func (m *RedisClient) Close() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Close") +} + +// Close indicates an expected call of Close. +func (mr *RedisClientMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*RedisClient)(nil).Close)) +} + // Delete mocks base method. func (m *RedisClient) Delete(arg0 context.Context, arg1 ...string) error { m.ctrl.T.Helper() diff --git a/pkg/thumbnail/amqp.go b/pkg/thumbnail/amqp.go index 700f0c56..e8d992d9 100644 --- a/pkg/thumbnail/amqp.go +++ b/pkg/thumbnail/amqp.go @@ -8,7 +8,7 @@ import ( absto "github.com/ViBiOh/absto/pkg/model" "github.com/ViBiOh/httputils/v4/pkg/tracer" vith "github.com/ViBiOh/vith/pkg/model" - "github.com/streadway/amqp" + amqp "github.com/rabbitmq/amqp091-go" ) func (a App) AMQPHandler(ctx context.Context, message amqp.Delivery) (err error) {