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

Spaces (or something) in file name screwed up intermediate URI #8

Open
tcoulter opened this issue Feb 5, 2014 · 0 comments
Open

Spaces (or something) in file name screwed up intermediate URI #8

tcoulter opened this issue Feb 5, 2014 · 0 comments
Labels

Comments

@tcoulter
Copy link
Contributor

tcoulter commented Feb 5, 2014

Spaces in a filename screwed up file creation while trying to upload a sketch file.

Here's my console output:

LayerVault.client.create_file("tims-org", "This is smee", "./", "Untitled copy.sketch", {:local_file_path => "./Untitled copy.sketch.tar.gz", :content_type => "application/tar-x"})
URI::InvalidURIError: bad URI(is not URI?): https://api.layervault.com/api/v1/tims-org/This%20is%20smee/Untitled%20copy.sketch/upload_complete?md5=47371919f8bdb6e35df40d8744db818a&remote_url=https://s3.amazonaws.com/omnivore-scratch/8329/1391639479.7579765/Untitled copy.sketch&bucket=omnivore-scratch&key=8329%2F1391639479.7579765%2FUntitled+copy.sketch&etag=%2247371919f8bdb6e35df40d8744db818a%22
    from /Users/tim/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:176:in `split'
    from /Users/tim/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
    from /Users/tim/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
    from /Users/tim/.rvm/gems/ruby-2.0.0-p195/gems/layervault-0.1.1/lib/layervault/client/files.rb:44:in `create_file'
    from (irb):7
    from /Users/tim/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>'

If I renamed both the resulting file to "sketchfile.sketch", and the file on disk to "sketchfile.tar.gz", everything worked like magic:

LayerVault.client.create_file("tims-org", "This is smee", "./", "sketchfile.sketch", {:local_file_path => "./sketchfile.sketch.tar.gz", :content_type => "application/tar-x"})
 => #<Faraday::Response:0x007fc783338b58 @env={:method=>:post, :body=>"{\"local_path\":\"~/LayerVault/This is smee/sketchfile.sketch\",\"name\":\"sketchfile.sketch\",\"created_at\":\"2014-02-05T22:32:49Z\",\"deleted_at\":null,\"updated_at\":\"2014-02-05T22:32:49Z\",\"modified_at\":\"2014-02-05T22:32:49Z\",\"md5\":\"47371919f8bdb6e35df40d8744db818a\",\"download_url\":\"https://layervault.com/files/download_node/qRaphM8a3D\",\"full_url\":\"https://layervault.com/tims-org/This%20is%20smee/sketchfile.sketch\",\"shortened_url\":\"http://lyrv.lt/bzg90ZEzKW\",\"revision_number\":1,\"revisions\":[{\"name\":\"1\",\"created_at\":\"2014-02-05T22:32:49Z\",\"deleted_at\":null,\"updated_at\":\"2014-02-05T22:32:49Z\",\"md5\":\"47371919f8bdb6e35df40d8744db818a\",\"download_url\":\"https://layervault.com/files/download_node/qRaphM8a3D\",\"full_url\":\"https://layervault.com/tims-org/This%20is%20smee/sketchfile.sketch/1\",\"shortened_url\":\"http://lyrv.lt/qRaphM8a3D\",\"revision_number\":1,\"user\":{\"id\":8329,\"email\":\"[email protected]\",\"first_name\":\"Tim\",\"last_name\":\"Coulter\",\"is_admin\":true},\"previews\":[]}]}", :url=>#<URI::HTTPS:0x007fc78332b750 URL:https://api.layervault.com/api/v1/tims-org/This%20is%20smee/sketchfile.sketch/upload_complete?md5=47371919f8bdb6e35df40d8744db818a&remote_url=https%3A%2F%2Fs3.amazonaws.com%2Fomnivore-scratch%2F8329%2F1391639567.7566328%2Fsketchfile.sketch&bucket=omnivore-scratch&key=8329%2F1391639567.7566328%2Fsketchfile.sketch&etag=%2247371919f8bdb6e35df40d8744db818a%22&access_token=e34cb1e4cc25ff8a82796c86c44fa8a51c9c8a06aa6e98c90c6d4c70fd662b00>, :request_headers=>{"User-Agent"=>"Faraday v0.8.8", "Content-Length"=>"0"}, :parallel_manager=>nil, :request=>{:proxy=>nil}, :ssl=>{}, :status=>200, :response_headers=>{"server"=>"nginx/1.4.2", "x-rack-cache"=>"invalidate, pass", "cache-control"=>"max-age=0, private, must-revalidate", "content-type"=>"application/json; charset=utf-8", "date"=>"Wed, 05 Feb 2014 22:32:50 GMT", "status"=>"200 OK", "x-rate-limit-remaining"=>"4997", "x-request-id"=>"0d7b693839ca5cf1872ebe0502caf41a", "location"=>"/api/v1/1014557/This%20is%20smee/sketchfile.sketch", "transfer-encoding"=>"chunked", "x-runtime"=>"1.016910", "connection"=>"close", "x-rate-limit-limit"=>"5000", "x-ua-compatible"=>"IE=Edge,chrome=1"}, :response=>#<Faraday::Response:0x007fc783338b58 ...>}, @on_complete_callbacks=[]> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant