Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

uploader: respect Content-Type from MIME part header #276

Merged
merged 6 commits into from
Sep 18, 2023

Conversation

roman-khimov
Copy link
Member

@roman-khimov roman-khimov commented Sep 16, 2023

It makes sense in general (since HTTP Content-Type is multipart/form) and browsers usually set it. This will help to have a more secure send.fs.neo.org since explicit Content-Type is then always returned for GETs (otherwise it's autodetected).

It makes sense in general (since HTTP Content-Type is multipart/form) and
browsers usually set it. This will help have a more secure send.fs.neo.org
since explicit Content-Type is then always returned for GETs (otherwise it's
autodetected).

Signed-off-by: Roman Khimov <roman@nspcc.ru>
@codecov
Copy link

codecov bot commented Sep 16, 2023

Codecov Report

Merging #276 (b71e885) into master (a545ebd) will decrease coverage by 0.15%.
Report is 3 commits behind head on master.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
- Coverage   34.39%   34.24%   -0.15%     
==========================================
  Files          10       10              
  Lines        1378     1384       +6     
==========================================
  Hits          474      474              
- Misses        862      868       +6     
  Partials       42       42              
Files Changed Coverage Δ
uploader/multipart.go 0.00% <ø> (ø)
uploader/upload.go 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Can't find any other mismatch, so fixes #272.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Not critical for HTTP gateway itself, but asymmetric and causes panic on
attempt to perform tests with two AIO versions:

--- FAIL: TestIntegration (48.12s)
panic: duplicate metrics collector registration attempted [recovered]
        panic: duplicate metrics collector registration attempted

goroutine 5 [running]:
testing.tRunner.func1.2({0x1035fe0, 0xc00674db80})
        /usr/lib64/go/1.20/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
        /usr/lib64/go/1.20/src/testing/testing.go:1529 +0x39f
panic({0x1035fe0, 0xc00674db80})
        /usr/lib64/go/1.20/src/runtime/panic.go:884 +0x213
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0x113c8f3?, {0xc007063ac0?, 0x1, 0xf?})
        /home/rik/go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:406 +0x85
github.com/prometheus/client_golang/prometheus.MustRegister(...)
        /home/rik/go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:178
github.com/nspcc-dev/neofs-http-gw/metrics.stateMetrics.register({{0x1393af0?, 0xc0077786c0?}, 0xc000627448?})
        /home/rik/dev/neofs-http-gw/metrics/metrics.go:95 +0xfd
github.com/nspcc-dev/neofs-http-gw/metrics.NewGateMetrics(0x113bb40?, 0x7?)
        /home/rik/dev/neofs-http-gw/metrics/metrics.go:58 +0x45
github.com/nspcc-dev/neofs-http-gw.(*app).initMetrics(0xc0076248c0)
        /home/rik/dev/neofs-http-gw/app.go:213 +0x54
github.com/nspcc-dev/neofs-http-gw.newApp({0x138cf08, 0xc006d928c0}, {0xc005135cc8, 0x2, 0x0?})
        /home/rik/dev/neofs-http-gw/app.go:185 +0x1045
github.com/nspcc-dev/neofs-http-gw.runServer()
        /home/rik/dev/neofs-http-gw/integration_test.go:103 +0x125
github.com/nspcc-dev/neofs-http-gw.TestIntegration(0x0?)
        /home/rik/dev/neofs-http-gw/integration_test.go:78 +0x3fe
testing.tRunner(0xc000102680, 0x1261428)
        /usr/lib64/go/1.20/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
        /usr/lib64/go/1.20/src/testing/testing.go:1629 +0x3ea

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Signed-off-by: Roman Khimov <roman@nspcc.ru>
It was needed before neofs-aio 0.37.0.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
AIO was updated to solve this.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
@roman-khimov roman-khimov force-pushed the use-file-content-type-from-request branch from 596aa7c to b71e885 Compare September 17, 2023 19:37
integration_test.go Outdated Show resolved Hide resolved
@roman-khimov roman-khimov added this to the v0.28.0 milestone Sep 18, 2023
@roman-khimov roman-khimov merged commit 050db88 into master Sep 18, 2023
10 of 12 checks passed
@roman-khimov roman-khimov deleted the use-file-content-type-from-request branch September 18, 2023 07:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants