upload fixes
This commit is contained in:
@@ -40,10 +40,10 @@ class Download
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pixiv_http_exists?
|
def pixiv_http_exists?(url)
|
||||||
# example: http://img01.pixiv.net/img/as-special/15649262_big_p2.jpg
|
# example: http://img01.pixiv.net/img/as-special/15649262_big_p2.jpg
|
||||||
exists = false
|
exists = false
|
||||||
uri = URI.parse(source)
|
uri = URI.parse(url)
|
||||||
Net::HTTP.start(uri.host, uri.port) do |http|
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
||||||
headers = {"Referer" => "http://www.pixiv.net", "User-Agent" => "#{Danbooru.config.app_name}/#{Danbooru.config.version}"}
|
headers = {"Referer" => "http://www.pixiv.net", "User-Agent" => "#{Danbooru.config.app_name}/#{Danbooru.config.version}"}
|
||||||
http.request_head(uri.request_uri, headers) do |res|
|
http.request_head(uri.request_uri, headers) do |res|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => x
|
rescue Exception => x
|
||||||
update_attribute(:status, "error: #{x.class} - #{x.message} - #{x.backtrace.join("\n")}")
|
update_attribute(:status, "error: #{x.class} - #{x.message}")
|
||||||
ensure
|
ensure
|
||||||
delete_temp_file
|
delete_temp_file
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user