Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issues with multipart in rails app #61

Closed
amw opened this Issue · 8 comments

2 participants

@amw
amw commented

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

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
Owner

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
amw commented

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

https://github.com/blackwinter/ruby-filemagic/blob/master/lib/filemagic/ext.rb

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
Owner

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
Owner

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
Closed

Faraday's multipart support and ruby-filemagic #211

@amw
amw commented

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

Let me see if this solved the problem.

@amw
amw commented

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
amw commented

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 steved referenced this issue from a commit
@steved steved Faraday 0.9 compatibility
* Removes all faraday_middleware dependencies
* Updates multipart-post for #61
fff6460
@steved
Owner

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

@steved steved closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.