nowa / carrierwave-upyun

UpYun storage for CarrierWave
161 stars 27 forks source link

上传文件名含中文的文件,报错URI::InvalidURIError #36

Closed Lupeipei closed 4 years ago

Lupeipei commented 4 years ago

你好,如题,上传文件,文件名含中文,报错 URI::InvalidURIError。 version: rails 6.0.2.1 ruby 2.6.0 carrierwave 2.0.2 carrierwave-upyun 1.0.2 看报错 的full trace, 显示 carrierwave/storage/upyun/file.rb:100:in headers' lib/carrierwave/storage/upyun/file.rb的 headers:

      def headers
        @headers ||= begin
          conn.get(@path).headers
        rescue Faraday::ClientError
          {}
        end
      end

debug后,发现 \@path 是原文件名,含中文,未encode,将 conn.get(@path) 改为 conn.get(escaped_path) 后,没有问题了,应该是个bug。