Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk upload method returns err if content type exists charset #143

Open
Halfi opened this issue Apr 3, 2019 · 2 comments
Open

Bulk upload method returns err if content type exists charset #143

Halfi opened this issue Apr 3, 2019 · 2 comments
Labels

Comments

@Halfi
Copy link

Halfi commented Apr 3, 2019

If server returns content type like this application/json; charset=utf-8, it brokens client.

swift/swift.go

Line 1993 in 24e3012

if headers["Content-Type"] != "application/json" {

Please use strings.Contains instead equal.

	// Detect old servers which don't support this feature
	if !strings.Contains(headers["Content-Type"], "application/json") {
		err = Forbidden
		return
	}
@Halfi Halfi changed the title Bulk upload method return err if content type exists charset Bulk upload method returns err if content type exists charset Apr 3, 2019
@ncw
Copy link
Owner

ncw commented Apr 4, 2019

Ah, well spotted!

Actually calling mime.ParseMediaType is the correct thing to do to parse it.

Fancy sending a PR to fix?

@ncw ncw added the bug label Apr 4, 2019
@ncw
Copy link
Owner

ncw commented Apr 4, 2019

There is probably more than one place in the code which needs fixing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants