Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Issues with multipart in rails app #61

amw opened this Issue Nov 5, 2012 · 8 comments


None yet
2 participants

amw commented Nov 5, 2012

I'm unable to post a ticket in my rails app. Here's a gist with all the information I could get:

I am able to post the ticket if I edit lib/zendesk_api/client.rb and comment out builder.request :multipart. Of course that's no solution, because it would break file uploads.


steved commented Nov 5, 2012

I wasn't able to reproduce this using the same Gemfile and a clean Rails app. Is there any reason String might respond to content_type?


amw commented Nov 6, 2012

That's exactly right. Seems that ruby-filemagic defines that method for String:


I'm not sure why they do that. Doesn't seem to be required for the core functionality provided by that gem. Do you think we should change object detection code in zendesk client or should I contact someone at filemagic and ask for the rationale of their string extension?


steved commented Nov 6, 2012

It's actually a problem between Faraday's Multipart middleware and Filemagic 1
I'd like to see what we can do upstream before working around it in this gem.


steved commented Nov 6, 2012

This PR should fix it: nicksieger/multipart-post#20
I've changed the Gemfile for now to point to my fork of multipart-post. Let me know if this helps fix your problem.

@amw amw referenced this issue in lostisland/faraday Nov 6, 2012


Faraday's multipart support and ruby-filemagic #211


amw commented Nov 6, 2012

Oh, I've already posted on Faraday: https://github.com/technoweenie/faraday/issues/211

Let me see if this solved the problem.


amw commented Nov 6, 2012

Your change to mulipart-post has fixed the issue for me, but I had to put this in my app's gemfile:

gem "multipart-post", :git => "git://github.com/steved555/multipart-post.git"
gem 'zendesk_api'

The change to zendesk gemfile doesn't affect bundler. You would have to modify your gemspec.


amw commented Feb 4, 2014

It seems that your pull request was merged into multipart-post 2.0.0, but Faraday 0.8.x allows only multipart-post < 2.0. Faraday 0.9.0 was released and it allows newer multipart-post, but there is no faraday_middleware compatible with faraday 0.9. Note that there is faraday_middleware 0.9, but it looks like some autorelease - it's gem spec was not updated to allow newer faraday.

It seems that there are some backward incompatible changes in faraday 0.9 that prevent immediate support in the middleware. lostisland/faraday_middleware#74 tracks some of the required updates. You'll have to wait for that gem to be updated before you can change your dependencies.

steved added a commit that referenced this issue Feb 10, 2014

Faraday 0.9 compatibility
* Removes all faraday_middleware dependencies
* Updates multipart-post for #61

steved commented Feb 10, 2014

Yep, thanks!
I'm going to close this and track the Faraday upgrade in #152

@steved steved closed this Feb 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment