How can I pass an uploaded file to an app proxy in my theme app extension?

In my Theme app extension I have a form that allows users to upload a .pdf to my app, via the app proxy.

Sending the form works fine for regular data, but when I try to send a file (using multipart/form-data) the server returns “the input of URI.decode_www_form must be ASCII only string” and my data never reaches the proxy.

I’ve traced this back to the proxy.rb file (part of shopify_cli), which indeed runs URI.decode_www_form over my form data (which may contain non-ascii data)

Am I doing something wrong, or is this expected behaviour? How can I allow sending files to the app proxy?

1 Like