diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index d1e27edec..11fc0f60d 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -26,7 +26,7 @@ module PostsHelper text = "pixiv/#{$1}" source_link = link_to(text, post.normalized_source) source_search = "source:#{text}/" - elsif post.source =~ /^http/ + elsif post.source =~ %r{\Ahttps?://} text = truncate(post.normalized_source.sub(/^https?:\/\/(?:www\.)?/, "")) source_link = link_to(truncate(text, :length => 20), post.normalized_source) source_search = "source:#{post.source.sub(/[^\/]*$/, "")}" diff --git a/app/views/posts/index.atom.erb b/app/views/posts/index.atom.erb index 598bf1c9f..a0159ba17 100644 --- a/app/views/posts/index.atom.erb +++ b/app/views/posts/index.atom.erb @@ -14,7 +14,7 @@ <%= post.presenter.humanized_essential_tag_string %> - <% if post.source =~ /^http/ %> + <% if post.source =~ %r{\Ahttps?://} %> <% end %> http://<%= Danbooru.config.hostname %>/posts/<%= post.id %>