aliyun-beta / aliyun-oss-ruby-sdk

Ruby SDK for Aliyun Open Simple Storage
Apache License 2.0
17 stars 3 forks source link

中文文件名操作问题 #2

Closed dingchunlai closed 8 years ago

dingchunlai commented 8 years ago

当文件名包含中文是操作就会出错

zlx commented 8 years ago

@dingchunlai 你指的是什么接口

dingchunlai commented 8 years ago

file = File.new('/Users/elele/Downloads/拍卖规则中文版.pdf') => #File:/Users/elele/Downloads/拍卖规则中文版.pdf 1.9.3-p448 :004 > client.bucket_objects.create("offline/doc/拍卖规则中文版.pdf", file, { 'Content-Type' => "application/pdf" }) URI::InvalidURIError: bad URI(is not URI?): http://huabidtest.oss-cn-hangzhou.aliyuncs.com/offline/doc/拍卖规则中文版.pdf from /Users/elele/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/common.rb:176:in split' from /Users/elele/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/common.rb:211:inparse' from /Users/elele/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/uri/common.rb:747:in parse' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty/request.rb:53:inpath=' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty/request.rb:43:in initialize' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty.rb:545:innew' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty.rb:545:in perform_request' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty.rb:502:input' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/httparty-0.13.7/lib/httparty.rb:595:in put' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/aliyun-oss-sdk-0.1.4/lib/aliyun/oss/http.rb:54:inrequest' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/aliyun-oss-sdk-0.1.4/lib/aliyun/oss/http.rb:21:in put' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/aliyun-oss-sdk-0.1.4/lib/aliyun/oss/api/bucket_objects.rb:44:inbucket_create_object' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/aliyun-oss-sdk-0.1.4/lib/aliyun/oss/client/bucket_objects.rb:31:in create' from (irb):4 from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.11/lib/rails/commands/console.rb:47:instart' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in start' from /Users/elele/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.11/lib/rails/commands.rb:41:in<top (required)>' from script/rails:5:in `require'

dingchunlai commented 8 years ago

client.bucket_objects.create("offline/doc/sss.pdf", file, { 'Content-Type' => "application/pdf" }) => true

dingchunlai commented 8 years ago

只要这个key中不包含中文 操作就都可以

zlx commented 8 years ago

@dingchunlai 已修复,你使用 Github 的最新代码吧

dingchunlai commented 8 years ago

太谢谢了

zlx commented 8 years ago

@dingchunlai 已发布新版,你可以使用最新版本: 0.1.5