Merge branch 'master' of github.com:r888888888/danbooru

This commit is contained in:
Albert Yi
2018-03-28 17:19:35 -07:00
2 changed files with 11 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ class StorageManager
elsif type == :large && post.has_large?
"#{base_url}/sample/#{subdir}#{seo_tags(post)}#{file}"
else
"#{base_url}/#{subdir}#{seo_tags(post)}#{file}"
"#{base_url}/#{subdir}#{seo_tags(post)}#{post.md5}.#{post.file_ext}"
end
end

View File

@@ -2653,6 +2653,16 @@ class PostTest < ActiveSupport::TestCase
end
end
context "URLs:" do
should "generate the correct urls for animated gifs" do
@post = FactoryGirl.build(:post, md5: "deadbeef", file_ext: "gif", tag_string: "animated_gif")
assert_equal("http://localhost/data/preview/deadbeef.jpg", @post.preview_file_url)
assert_equal("http://localhost/data/deadbeef.gif", @post.large_file_url)
assert_equal("http://localhost/data/deadbeef.gif", @post.file_url)
end
end
context "Mass assignment: " do
should_not allow_mass_assignment_of(:last_noted_at).as(:member)
end