From 9ec23e6d3f2ecacc122aa092dfb0a369685c18c7 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sat, 14 Mar 2015 00:17:07 -0500 Subject: [PATCH] Max file size of 100MB to prevent movie piracy --- models/site.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/site.rb b/models/site.rb index 0982a86a..95c9ccb8 100644 --- a/models/site.rb +++ b/models/site.rb @@ -60,6 +60,8 @@ class Site < Sequel::Model SCREENSHOT_RESOLUTIONS = ['540x405', '210x158', '100x100', '50x50'] THUMBNAIL_RESOLUTIONS = ['210x158'] + MAX_FILE_SIZE = 10**8 # 100 MB + CLAMAV_THREAT_MATCHES = [ /^VBS/, /^PUA\.Win32/, @@ -911,7 +913,7 @@ class Site < Sequel::Model end def file_size_too_large?(size) - return true if size + space_used > maximum_space + return true if size > MAX_FILE_SIZE || size + space_used > maximum_space false end