From 9377af77952033a35d0be2b2083e638b2cb32deb Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 27 Apr 2015 00:20:10 +0200 Subject: [PATCH] Added size limit of 5 MB for screenshots --- app/models/screenshot.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/screenshot.rb b/app/models/screenshot.rb index 792a66b..e74d21c 100644 --- a/app/models/screenshot.rb +++ b/app/models/screenshot.rb @@ -11,6 +11,7 @@ class Screenshot < ActiveRecord::Base path: ':rails_root/public/screenshots/:id_partition/:style.png', url: '/screenshots/:id_partition/:style.png' validates_attachment_content_type :image, :content_type => 'image/png' + validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes # Return caption for full-screen screenshots. # Takes the description of a screenshot if available.