swift
swift copied to clipboard
Bulk upload method returns err if content type exists charset
If server returns content type like this application/json; charset=utf-8
, it brokens client.
https://github.com/ncw/swift/blob/24e3012fc8a71f004a6455bce2088031d50bf2b6/swift.go#L1993
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
}
Ah, well spotted!
Actually calling mime.ParseMediaType is the correct thing to do to parse it.
Fancy sending a PR to fix?
There is probably more than one place in the code which needs fixing...