Open Halfi opened 5 years ago
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
application/json; charset=utf-8
Please use strings.Contains instead equal.
strings.Contains
// 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...
If server returns content type like this
application/json; charset=utf-8
, it brokens client. https://github.com/ncw/swift/blob/24e3012fc8a71f004a6455bce2088031d50bf2b6/swift.go#L1993Please use
strings.Contains
instead equal.