Fix #3396: Pixiv novel cover IDs are parsed incorrectly.

This commit is contained in:
evazion
2017-11-21 12:54:47 -06:00
parent 4d6dc895d6
commit a14c492020
3 changed files with 5 additions and 5 deletions

View File

@@ -331,7 +331,7 @@ module Sources
return true if url =~ %r!#{PXIMG}/img-original/img/#{TIMESTAMP}/\d+_\w+\.#{EXT}!i
# http://i1.pixiv.net/img-zip-ugoira/img/2014/10/03/17/29/16/46323924_ugoira1920x1080.zip
return true if url =~ %r!#{I12}|#{PXIMG}/img-zip-ugoira/img/#{TIMESTAMP}/\d+_ugoira\d+x\d+\.zip$!i
return true if url =~ %r!(#{I12}|#{PXIMG})/img-zip-ugoira/img/#{TIMESTAMP}/\d+_ugoira\d+x\d+\.zip$!i
return false
end

View File

@@ -156,7 +156,7 @@ module Downloads
context "downloading a novel image" do
should "download new novel images" do
@file_url = "http://i1.pixiv.net/novel-cover-original/img/2016/11/03/20/10/58/7436075_f75af69f3eacd1656d3733c72aa959cf.jpg"
@file_size = 316_133
@file_size = 316_311
assert_not_rewritten(@file_url)
assert_downloaded(@file_size, @file_url)

View File

@@ -1475,15 +1475,15 @@ class PostTest < ActiveSupport::TestCase
should "save the pixiv id" do
@post.pixiv_id = 1234
@post.update(source: "http://i1.pixiv.net/novel-cover-original/img/2016/11/03/20/10/58/7436075_f75af69f3eacd1656d3733c72aa959cf.jpg")
assert_equal(7436075, @post.pixiv_id)
assert_nil(@post.pixiv_id)
@post.pixiv_id = 1234
@post.update(source: "http://i2.pixiv.net/background/img/2016/10/30/12/27/30/7059005_da9946b806c10d391a81ed1117cd33d6.jpg")
assert_equal(7059005, @post.pixiv_id)
assert_nil(@post.pixiv_id)
@post.pixiv_id = 1234
@post.update(source: "http://i1.pixiv.net/img15/img/omega777/novel/2612734.jpg")
assert_equal(2612734, @post.pixiv_id)
assert_nil(@post.pixiv_id)
@post.pixiv_id = 1234
@post.update(source: "http://img08.pixiv.net/profile/nice/1408837.jpg")