Fix #3395: fix pixiv API exception when uploading bad pixiv id images.

Fixes an exception when attempting to upload a Pixiv image from a
deleted work. The download strategy tries to fetch the source data in
the course of rewriting the URL, which fails if the work has been
deleted from Pixiv.

Raise a BadIDError and leave the URL as-is (don't rewrite it).
This commit is contained in:
evazion
2017-11-21 10:14:32 -06:00
parent 183a7e07e3
commit 0b5ed163fe
4 changed files with 37 additions and 14 deletions

View File

@@ -127,6 +127,14 @@ module Sources
end
end
context "fetching source data for a deleted work" do
should "raise a bad id error" do
assert_raise(::PixivApiClient::BadIDError) do
get_source("https://i.pximg.net/img-original/img/2017/11/22/01/06/44/65991677_p0.png")
end
end
end
context "fetching the commentary" do
should "work when the description is blank" do
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981746")