mitmproxy icon indicating copy to clipboard operation
mitmproxy copied to clipboard

Fix Multipart content view parsing

Open DaniElectra opened this issue 4 months ago • 2 comments

Description

On get_message_content_view, the content type wasn't including the boundary, and was only setting the MIME type. This made the multipart content view unusable, as the boundary was required on parsing. To fix the issue, we assign the full content type instead.

This wasn't triggered by any previous tests because they would test against the multipart parser directly, and not the generic parser.

Checklist

  • [X] I have updated tests where applicable.
  • [x] I have added an entry to the CHANGELOG.

DaniElectra avatar Feb 09 '24 19:02 DaniElectra

I'm not sure why the check is failing?

DaniElectra avatar Feb 12 '24 21:02 DaniElectra

https://github.com/mitmproxy/mitmproxy/actions/runs/7878070568/job/21495523975?pr=6653#step:5:74

Test is failing because test_multipart is not covering line 17. Only test_api does. We are (a bit too) strict here...

Cheap fix is to list http_message directly as an arg and then not have any branches: https://github.com/mitmproxy/mitmproxy/blob/1a02ebb89f6765d827f2fe0086dfe5960eb6e093/mitmproxy/contentviews/query.py#L8-L12

Thanks for the quick RTT! 🍰

mhils avatar Feb 12 '24 21:02 mhils

This PR should be good now!

DaniElectra avatar Mar 08 '24 20:03 DaniElectra