#1866: hentai foundry source link redirects

This commit is contained in:
Toks
2013-12-08 00:13:57 -05:00
parent 95595bda06
commit 2b442253ad
2 changed files with 8 additions and 0 deletions

View File

@@ -310,6 +310,9 @@ class Post < ActiveRecord::Base
when %r{\Ahttp://p\.twpl\.jp/show/orig/([a-z0-9]+)}i
"http://p.twipple.jp/#{$1}"
when %r{\Ahttp://pictures\.hentai-foundry\.com//a/([^/]+)/(\d+)\.}i
"http://www.hentai-foundry.com/pictures/user/#{$1}/#{$2}"
else
source
end

View File

@@ -814,6 +814,11 @@ class PostTest < ActiveSupport::TestCase
@post.source = "http://p.twpl.jp/show/orig/mI2c3"
assert_equal("http://p.twipple.jp/mI2c3", @post.normalized_source)
end
should "normalize hentai foundry links" do
@post.source = "http://pictures.hentai-foundry.com//a/AnimeFlux/219123.jpg"
assert_equal("http://www.hentai-foundry.com/pictures/user/AnimeFlux/219123", @post.normalized_source)
end
end
end
end