fetch ugoiras for batch action #3317

This commit is contained in:
r888888888
2017-10-03 13:36:56 -07:00
parent 6fdb8ae893
commit 014b9af5f8
3 changed files with 12 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
force_ssl :if => :ssl_login?
helper_method :show_moderation_notice?
rescue_from Exception, :with => :rescue_exception
# rescue_from Exception, :with => :rescue_exception
rescue_from User::PrivilegeError, :with => :access_denied
rescue_from SessionLoader::AuthenticationFailure, :with => :authentication_failed
rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit

View File

@@ -114,7 +114,9 @@ class PixivApiClient
@tags = json["tags"].reject {|x| x =~ /^http:/}
@tags += json["tools"] - TOOLS_BLACKLIST
if page_count > 1
if json["metadata"]["zip_urls"]
@pages = json["metadata"]["zip_urls"]
elsif page_count > 1
@pages = json["metadata"]["pages"].map {|x| x["image_urls"]["large"]}
else
@pages = [json["image_urls"]["large"]]

View File

@@ -28,6 +28,14 @@ class UploadsControllerTest < ActionController::TestCase
assert_response :success
end
end
context "for pixiv ugoira galleries" do
should "render" do
get :batch, {:url => "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=59523577"}, {:user_id => @user.id}
assert_response :success
assert_no_match(/59523577_ugoira0\.jpg/, response.body)
end
end
end
context "new action" do