fixes #2215 hopefully

* improved domain support
* renamed archived files will be redirected to the latest version; users still have to click 'File history' to view the old ones

note: it appears wikia doesn't support yet #filehistory and #mediaviewer from wikipedia
This commit is contained in:
ghostrigger
2014-07-02 08:23:18 +08:00
parent d79cec75d0
commit 42857cd552

View File

@@ -339,7 +339,7 @@ class Post < ActiveRecord::Base
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}"
when %r{\Ahttps?://(?:slot\d*\.)?im(?:g|ages)\d*\.wikia\.nocookie\.net/(?:_{2}cb\d{14}/)?([^/]+)(?:/[a-z]{2})?/images/(?:(?:thumb|archive)?/)?[a-f0-9]/[a-f0-9]{2}/([^/]+)}i
when %r{\Ahttps?://(?:slot\d*\.)?im(?:g|ages)\d*\.wikia\.(?:nocookie\.net|com)/(?:_{2}cb\d{14}/)?([^/]+)(?:/[a-z]{2})?/images/(?:(?:thumb|archive)?/)?[a-f0-9]/[a-f0-9]{2}/(?:\d{14}(?:!|%21))?([^/]+)}i
subdomain = $1
filename = $2
"http://#{subdomain}.wikia.com/wiki/File:#{filename}"