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

Passing in a Pathname object as local for download! fails #29

Open
ezekg opened this issue Aug 29, 2016 · 3 comments
Open

Passing in a Pathname object as local for download! fails #29

ezekg opened this issue Aug 29, 2016 · 3 comments

Comments

@ezekg
Copy link

ezekg commented Aug 29, 2016

I'm assuming the Pathname object implements the write method, so this error is mistakenly thrown. Casting the Pathname object to a string fixes the issue, but this was rather hard to debug since the error message was about using an in-memory buffer.

To reproduce,

download! "some/path", Pathname.new("/some/other/path").parent, {
  recursive: true
}

To fix,

download! "some/path", Pathname.new("/some/other/path").parent.to_s, {
  recursive: true
}

What if we automatically perform a to_s on Pathname objects to catch this?

@ezekg
Copy link
Author

ezekg commented Aug 29, 2016

For reference, here's an issue that was reported to me with a stack trace: themejuice/tj#73

@zetetic
Copy link

zetetic commented Dec 2, 2016

Similar behavior occurs for upload! -- passing a Pathname object as the 'remote' argument raises an exception when the channel is closed. Converting the 'remote' to a string does not raise an exception -- in both cases the upload itself succeeds.

@mfazekas
Copy link
Collaborator

mfazekas commented Dec 3, 2016

I think instead of write we could check for is_a?(StringIO) i don't see it docmented that user can passin anything that accepts a write

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

3 participants