Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.01k stars 131 forks source link

MultiPartReader produces invalid multipart bodies #291

Closed recmo closed 3 years ago

recmo commented 3 years ago

https://github.com/Byron/google-apis-rs/blob/main/gen/storage1/src/client.rs#L452

This write terminates the part headers with a single \r\n where a double \r\n\r\n is required. Consequentially every simple object insert call fails with status 400 and response body Malformed multipart body..

The reader also incorrectly adds an \r\n at the beginning and omits the one at the end of the last line, but this doesn't seem to bother the Google server.

In an unrelated issue: the error gets consumed from the response stream but does not get parsed since it is not JSON. A client::Error::Failure(response) is returned, but the response.body can no longer be read and the original server error message is lost.

Byron commented 3 years ago

Thanks a lot for bringing it up and for the fix! Quite amazing that such a blatant issue could survive for so long.

Byron commented 3 years ago

The crate with patch applied was released.