Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errno::ENOENT in multipart-post-1.0.1/lib/parts.rb:42 #5

Closed
gavinkou opened this issue Oct 28, 2010 · 3 comments
Closed

Errno::ENOENT in multipart-post-1.0.1/lib/parts.rb:42 #5

gavinkou opened this issue Oct 28, 2010 · 3 comments

Comments

@gavinkou
Copy link

gavinkou commented Oct 28, 2010

when POST a.jpg to server with new name 'a'.
it will raise:

/home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/parts.rb:42:in `size': No such file or directory - 2 (Errno::ENOENT)
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/parts.rb:42:in`initialize'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/parts.rb:5:in `new'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/parts.rb:5:in`new'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `initialize'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/composite_io.rb:76:in`map'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `each'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in`map'
        from /home/gavin_kou/local/lib/ruby/gems/1.8/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `initialize'

in parts.rb line 41. change from:

file_length = io.respond_to?(:length) ?  io.length : File.size(io.local_path)

to

file_length = io.respond_to?(:length) ?  io.length : File.size(io.path)

it works fine.

@gavinkou
Copy link
Author

other side. looks when a file size is zero, it raise the same exception also.

@ioquatix
Copy link
Member

ioquatix commented May 2, 2017

Do you mind trying this again on the latest 2.0 release and let me know if this is still a problem?

@ioquatix
Copy link
Member

ioquatix commented Jun 3, 2022

Despite the documentation, it's not possible to construct a FilePart from an IO instance, you need to wrap it in an UploadIO first.

@ioquatix ioquatix closed this as completed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants