Fix #5012: Fc2 image link paste not uploading.
Fix referer spoofing not working for certain fc2.com image URLs. Spoofing the referer like this redirects to an HTML error page: * curl -H "Referer: http://wwwew.web.fc2.com" http://wwwew.web.fc2.com/e/405.jpg Spoofing it like this works: * curl -H "Referer: http://wwwew.web.fc2.com/e/405.jpg" http://wwwew.web.fc2.com/e/405.jpg
This commit is contained in:
@@ -6,7 +6,7 @@ module Danbooru
|
||||
HTTP::Options.register_feature :spoof_referrer, self
|
||||
|
||||
def perform(request, &block)
|
||||
request.headers["Referer"] = request.uri.origin unless request.headers["Referer"].present?
|
||||
request.headers["Referer"] = request.uri unless request.headers["Referer"].present?
|
||||
response = yield request
|
||||
response
|
||||
end
|
||||
|
||||
@@ -356,6 +356,8 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
||||
should_upload_successfully("https://c.fantia.jp/uploads/post/file/1070093/16faf0b1-58d8-4aac-9e86-b243063eaaf1.jpeg")
|
||||
should_upload_successfully("https://fantia.jp/posts/1132267")
|
||||
should_upload_successfully("https://fantia.jp/products/249638")
|
||||
|
||||
should_upload_successfully("http://wwwew.web.fc2.com/e/405.jpg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user