Commit 219f1c58 by LI Daobing

remove fix_path

parent e1bd195a
...@@ -46,7 +46,7 @@ module Paperclip ...@@ -46,7 +46,7 @@ module Paperclip
def flush_deletes def flush_deletes
init init
for path in @queued_for_delete do for path in @queued_for_delete do
::Qiniu::RS.delete(bucket, fix_path(path)) ::Qiniu::RS.delete(bucket, path)
end end
@queued_for_delete = [] @queued_for_delete = []
end end
...@@ -54,9 +54,9 @@ module Paperclip ...@@ -54,9 +54,9 @@ module Paperclip
def public_url(style = default_style) def public_url(style = default_style)
init init
if @options[:qiniu_host] if @options[:qiniu_host]
"#{dynamic_fog_host_for_style(style)}/#{fix_path(path(style))}" "#{dynamic_fog_host_for_style(style)}/#{path(style)}"
else else
res = ::Qiniu::RS.get(bucket, fix_path(path(style))) res = ::Qiniu::RS.get(bucket, path(style))
if res if res
res["url"] res["url"]
else else
...@@ -74,7 +74,6 @@ module Paperclip ...@@ -74,7 +74,6 @@ module Paperclip
end end
def upload(file, path) def upload(file, path)
path = fix_path(path)
remote_upload_url = ::Qiniu::RS.put_auth remote_upload_url = ::Qiniu::RS.put_auth
opts = {:url => remote_upload_url, opts = {:url => remote_upload_url,
:file => file.path, :file => file.path,
...@@ -98,10 +97,6 @@ module Paperclip ...@@ -98,10 +97,6 @@ module Paperclip
@options[:qiniu_host] @options[:qiniu_host]
end end
end end
def fix_path(path)
path.gsub(/^\//, '')
end
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment