Use String#b

Akinori MUSHA 9 年之前
父节点
当前提交
11d2ee0a14
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/models/agents/ftpsite_agent.rb

+ 1 - 1
app/models/agents/ftpsite_agent.rb

@@ -196,7 +196,7 @@ module Agents
196 196
     end
197 197
 
198 198
     def uri_path_escape(string)
199
-      str = string.dup.force_encoding(Encoding::ASCII_8BIT)  # string.b in Ruby >=2.0
199
+      str = string.b
200 200
       str.gsub!(/([^A-Za-z0-9\-._~!$&()*+,=@]+)/) { |m|
201 201
         '%' + m.unpack('H2' * m.bytesize).join('%').upcase
202 202
       }