[GH-ISSUE #1828] Image preview in multpart/form-data breaks the app #1820

Open
opened 2026-03-03 19:54:39 +03:00 by kerem · 9 comments
Owner

Originally created by @petersamokhin on GitHub (Oct 25, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1828

Originally assigned to: @NghiaTranUIT on GitHub.

Description

When you upload a multipart request where one part is an image, ProxyMan tries to preview it (great feature btw!).
However, if the image part is not a valid image (or even if valid but maybe not supported by the preview tool you use), the app becomes unresponsive. Only "Force Quit Application" helps

Steps to Reproduce

  1. Make a regular multipart/form-data request
  2. Add a byte array part with content-type for some image (e.g. image/jpeg)
  3. Try to open "multipart" tab of the request
  4. (issue happens, app is unresponsive)

Current Behavior

Explained above, screenshot here:

image

Expected Behavior

Preview can be omitted, or an error text shown — but not the app frozen.
For me, it is enough to "export" the "part" as a file, no need for preview at all

Environment

Actually, happens for a few versions already + different macOS versions (on Sonoma too). Managed to file an issue only now :)

  • App version:Version 4.13.0 (49400)
  • macOS version: macOS Ventura 13.6 (22G120)
Originally created by @petersamokhin on GitHub (Oct 25, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1828 Originally assigned to: @NghiaTranUIT on GitHub. ## Description When you upload a multipart request where one part is an image, ProxyMan tries to preview it (great feature btw!). However, if the image part is not a valid image (or even if valid but maybe not supported by the preview tool you use), the app becomes unresponsive. Only "Force Quit Application" helps ## Steps to Reproduce 1. Make a regular multipart/form-data request 2. Add a byte array part with content-type for some image (e.g. image/jpeg) 3. Try to open "multipart" tab of the request 4. (issue happens, app is unresponsive) ## Current Behavior Explained above, screenshot here: <img width="599" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/20628184/f2a02f77-36ce-44bd-8241-854a88aa3d8f"> ## Expected Behavior Preview can be omitted, or an error text shown — but not the app frozen. For me, it is enough to "export" the "part" as a file, no need for preview at all ## Environment Actually, happens for a few versions already + different macOS versions (on Sonoma too). Managed to file an issue only now :) - App version:Version 4.13.0 (49400) - macOS version: macOS Ventura 13.6 (22G120)
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 26, 2023):

May I ask how big the Image is? I assume it's big so Proxyman takes a lot of time to process on the main thread -> causes the app hangs 🤔

It'd be nice if you export the Request/Response (Right-click -> Export -> ProxymanLog) and share it with us at support@proxyman.io ?

<!-- gh-comment-id:1780352875 --> @NghiaTranUIT commented on GitHub (Oct 26, 2023): May I ask how big the Image is? I assume it's big so Proxyman takes a lot of time to process on the main thread -> causes the app hangs 🤔 It'd be nice if you export the Request/Response (Right-click -> Export -> ProxymanLog) and share it with us at support@proxyman.io ?
Author
Owner

@petersamokhin commented on GitHub (Oct 26, 2023):

@NghiaTranUIT unfortunately I can't share the request 🙂 but the image is small, e.g. latest one I tested is 199 KB. Also, the app never unfreezes, waiting doesn't help

<!-- gh-comment-id:1780742821 --> @petersamokhin commented on GitHub (Oct 26, 2023): @NghiaTranUIT unfortunately I can't share the request 🙂 but the image is small, e.g. latest one I tested is 199 KB. Also, the app never unfreezes, waiting doesn't help
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 26, 2023):

@petersamokhin is it 100% reproducible?

May I ask what the Request/Response Body size? (You can get this data from the Request or Response column or from the Content-Length).

Multiparts works fine on my end, including images (< 1mb) and some JSON text.

<!-- gh-comment-id:1780770535 --> @NghiaTranUIT commented on GitHub (Oct 26, 2023): @petersamokhin is it 100% reproducible? May I ask what the Request/Response Body size? (You can get this data from the Request or Response column or from the Content-Length). Multiparts works fine on my end, including images (< 1mb) and some JSON text.
Author
Owner

@petersamokhin commented on GitHub (Oct 26, 2023):

@NghiaTranUIT yep, 100% reproducible every single time for me 😅

Content-Length: 199877 (most of the size is the mutlipart part). If I click on "multipart" tab instead of "raw", the app will be stuck forever
image

The next request with video (which works fine btw) is bigger. Export works with no problems, even for much bigger files (up to 100 mb at least)
Content-Length: 757946

The images I upload are JPEG but theoretically may be "worse" than regular images (maybe no EXIF and worse quality), still good for Finder "Preview" and QuickLook though. My assumption to investigate would be to check any steps that interact with the image itself, parse it or try to display, and put try/catch + resource/time limitations ther

<!-- gh-comment-id:1780779333 --> @petersamokhin commented on GitHub (Oct 26, 2023): @NghiaTranUIT yep, 100% reproducible every single time for me 😅 Content-Length: 199877 (most of the size is the mutlipart part). If I click on "multipart" tab instead of "raw", the app will be stuck forever <img width="709" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/20628184/c0ab7026-daf0-4eb6-8fae-8dde84a6b6e6"> The next request with video (which works fine btw) is bigger. Export works with no problems, even for much bigger files (up to 100 mb at least) Content-Length: 757946 The images I upload are JPEG but theoretically may be "worse" than regular images (maybe no EXIF and worse quality), still good for Finder "Preview" and QuickLook though. My assumption to investigate would be to check any steps that interact with the image itself, parse it or try to display, and put try/catch + resource/time limitations ther
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 27, 2023):

@petersamokhin can you try this Beta and let me know the result 👍 https://download.proxyman.io/beta/Proxyman_4.13.0_Improve_performance_Multiparts.dmg

Change log

  • Optimize the Raw Tab when displaying the Raw Multipparts data -> Prevent freeze app
  • Upgrade to the latest multipart-kit that fix some internal issues
<!-- gh-comment-id:1782416005 --> @NghiaTranUIT commented on GitHub (Oct 27, 2023): @petersamokhin can you try this Beta and let me know the result 👍 https://download.proxyman.io/beta/Proxyman_4.13.0_Improve_performance_Multiparts.dmg ### Change log - Optimize the Raw Tab when displaying the Raw Multipparts data -> Prevent freeze app - Upgrade to the latest multipart-kit that fix some internal issues
Author
Owner

@petersamokhin commented on GitHub (Oct 27, 2023):

@NghiaTranUIT checked just now — no difference. Once I click on the "Multipart" tab in the request preview, the whole app freezes forever. So, the "Multipart" tab needs to be optimized, not "Raw" :)

image
<!-- gh-comment-id:1782861988 --> @petersamokhin commented on GitHub (Oct 27, 2023): @NghiaTranUIT checked just now — no difference. Once I click on the "Multipart" tab in the request preview, the whole app freezes forever. So, the "Multipart" tab needs to be optimized, not "Raw" :) <img width="205" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/20628184/918a2d8e-732e-44ea-8ab1-3d12769a2f3b">
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 27, 2023):

May I ask: what macbook model are you using? 🤔

<!-- gh-comment-id:1782882425 --> @NghiaTranUIT commented on GitHub (Oct 27, 2023): May I ask: what macbook model are you using? 🤔
Author
Owner

@petersamokhin commented on GitHub (Oct 27, 2023):

@NghiaTranUIT Apple M1 Pro 32GB, 16-inch, 2021

<!-- gh-comment-id:1783020970 --> @petersamokhin commented on GitHub (Oct 27, 2023): @NghiaTranUIT Apple M1 Pro 32GB, 16-inch, 2021
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 28, 2023):

@petersamokhin I'm not sure why but I can't reproduce the freeze issue on Multipart Tab 😿 . Can you try again on this Beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_4.13.0_Prevent_rendering_Multiparts_twice.dmg

  • From what I investigated, the Multipart data is processed in the background and it doesn't block the UI. Even though the file is 20 MB, it might take 2-3 seconds to process, but never causes the hang issue.
  • The only hang issue is when switching to the Raw Tab -> Proxyman tries to display all raw strings on NSTextView, which causes worse performance -> It's fixed on the previous beta build by truncating the exceeded body.
  • If it doesn't fix you, can you try to export the request and share it with us via support@proxyman.io You can redact sensitive data. I'd appreciate it.

Video

https://github.com/ProxymanApp/Proxyman/assets/5878421/974e62a5-8951-4612-8ae5-faa3c12e9231

<!-- gh-comment-id:1783676600 --> @NghiaTranUIT commented on GitHub (Oct 28, 2023): @petersamokhin I'm not sure why but I can't reproduce the freeze issue on Multipart Tab 😿 . Can you try again on this Beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_4.13.0_Prevent_rendering_Multiparts_twice.dmg - From what I investigated, the Multipart data is processed in the background and it doesn't block the UI. Even though the file is 20 MB, it might take 2-3 seconds to process, but never causes the hang issue. - The only hang issue is when switching to the Raw Tab -> Proxyman tries to display all raw strings on NSTextView, which causes worse performance -> It's fixed on the previous beta build by truncating the exceeded body. - If it doesn't fix you, can you try to export the request and share it with us via support@proxyman.io You can redact sensitive data. I'd appreciate it. ### Video https://github.com/ProxymanApp/Proxyman/assets/5878421/974e62a5-8951-4612-8ae5-faa3c12e9231
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1820
No description provided.