diff --git a/app/logical/downloads/strategies/deviant_art.rb b/app/logical/downloads/strategies/deviant_art.rb index 45e939faf..32ebe028c 100644 --- a/app/logical/downloads/strategies/deviant_art.rb +++ b/app/logical/downloads/strategies/deviant_art.rb @@ -12,7 +12,7 @@ module Downloads protected def rewrite_html_pages(url, headers) - if url =~ %r{^http://.+?\.deviantart\.com/art/} + if url =~ %r{^https?://.+?\.deviantart\.com/art/} source = ::Sources::Strategies::DeviantArt.new(url) source.get return [source.image_url, headers] @@ -22,10 +22,10 @@ module Downloads end def rewrite_thumbnails(url, headers) - if url =~ %r{^(http://.+?\.deviantart\.net/.+?/)200H/} + if url =~ %r{^(https?://.+?\.deviantart\.net/.+?/)200H/} match = $1 url.sub!(match + "200H/", match) - elsif url =~ %r{^(http://.+?\.deviantart\.net/.+?/)PRE/} + elsif url =~ %r{^(https?://.+?\.deviantart\.net/.+?/)PRE/} match = $1 url.sub!(match + "PRE/", match) end diff --git a/app/logical/downloads/strategies/twitpic.rb b/app/logical/downloads/strategies/twitpic.rb index 4854da9cd..0939af09c 100644 --- a/app/logical/downloads/strategies/twitpic.rb +++ b/app/logical/downloads/strategies/twitpic.rb @@ -2,7 +2,7 @@ module Downloads module Strategies class Twitpic < Base def rewrite(url, headers) - if url =~ %r{http://twitpic\.com} || url =~ %r{^http://d3j5vwomefv46c\.cloudfront\.net} + if url =~ %r{https?://twitpic\.com} || url =~ %r{^https?://d3j5vwomefv46c\.cloudfront\.net} url, headers = rewrite_html_pages(url, headers) url, headers = rewrite_thumbnails(url, headers) end @@ -14,7 +14,7 @@ module Downloads def rewrite_html_pages(url, headers) # example: http://twitpic.com/cpprns - if url =~ %r{http://twitpic\.com/([a-z0-9]+)$} + if url =~ %r{https?://twitpic\.com/([a-z0-9]+)$} id = $1 url = "http://twitpic.com/show/full/#{id}" return [url, headers] @@ -24,7 +24,7 @@ module Downloads end def rewrite_thumbnails(url, headers) - if url =~ %r{^http://d3j5vwomefv46c\.cloudfront\.net/photos/thumb/(\d+\..+)$} + if url =~ %r{^https?://d3j5vwomefv46c\.cloudfront\.net/photos/thumb/(\d+\..+)$} match = $1 url.sub!("/thumb/" + match, "/large/" + match) end diff --git a/app/logical/sources/strategies/deviant_art.rb b/app/logical/sources/strategies/deviant_art.rb index cd7193a65..af2297898 100644 --- a/app/logical/sources/strategies/deviant_art.rb +++ b/app/logical/sources/strategies/deviant_art.rb @@ -58,9 +58,9 @@ module Sources def normalized_url @normalized_url ||= begin - if url =~ %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_[a-z0-9_]+-d([a-z0-9]+)\.}i + if url =~ %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_[a-z0-9_]+-d([a-z0-9]+)\.}i "http://fav.me/d#{$1}" - elsif url =~ %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i + elsif url =~ %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i "http://fav.me/d#{$1}" elsif url =~ %r{deviantart\.com/art/} url diff --git a/app/models/post.rb b/app/models/post.rb index 41b29cdbe..a71e45542 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -279,15 +279,15 @@ class Post < ActiveRecord::Base when %r{\Ahttp://lohas\.nicoseiga\.jp/priv/(\d+)\?e=\d+&h=[a-f0-9]+}i, %r{\Ahttp://lohas\.nicoseiga\.jp/priv/[a-f0-9]+/\d+/(\d+)}i "http://seiga.nicovideo.jp/seiga/im#{$1}" - when %r{\Ahttp://d3j5vwomefv46c\.cloudfront\.net/photos/large/(\d+)\.}i + when %r{\Ahttps?://d3j5vwomefv46c\.cloudfront\.net/photos/large/(\d+)\.}i base_10_id = $1.to_i base_36_id = base_10_id.to_s(36) "http://twitpic.com/#{base_36_id}" - when %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_([a-z0-9_]+)-d([a-z0-9]+)\.}i + when %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_([a-z0-9_]+)-d([a-z0-9]+)\.}i "http://#{$1}.deviantart.com/gallery/#/d#{$2}" - when %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i + when %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i "http://deviantart.com/gallery/#/d#{$1}" when %r{\Ahttp://www\.karabako\.net/images(?:ub)?/karabako_(\d+)(?:_\d+)?\.}i @@ -296,7 +296,7 @@ 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//[^/]/([^/]+)/(\d+)\.}i + when %r{\Ahttps?://pictures\.hentai-foundry\.com//[^/]/([^/]+)/(\d+)\.}i "http://www.hentai-foundry.com/pictures/user/#{$1}/#{$2}" else