#1866: support gelbooru source redirection

doesn't support the discontinued sha1 naming scheme in some older files
This commit is contained in:
ghostrigger
2014-06-16 01:19:27 +08:00
parent 964be9a633
commit aa7a91c98f

View File

@@ -324,6 +324,9 @@ class Post < ActiveRecord::Base
when %r{\Ahttp://static[1-6]?\.minitokyo\.net/(?:downloads|view)/(?:\d{2}/){2}(\d+)}i
"http://gallery.minitokyo.net/download/#{$1}"
when %r{\Ahttp://(?:(?:s?img|cdn|www)\d?\.)?gelbooru\.com/{1,2}(?:images|samples)/\d+/(?:sample_)?([a-f0-9]{32})\.}i
"http://gelbooru.com/index.php?page=post&s=list&md5=#{$1}"
else
source
end