This commit is contained in:
Kyle Drake 2013-06-23 19:53:26 -07:00
commit ed240b44f4
8 changed files with 23 additions and 7 deletions

2
app.rb
View file

@ -124,7 +124,7 @@ post '/site_files/upload' do
mime_type = Magic.guess_file_mime_type params[:newfile][:tempfile].path
unless Site::VALID_MIME_TYPES.include?(mime_type) && Site::VALID_EXTENSIONS.include?(File.extname(params[:newfile][:filename]).sub(/^./, ''))
unless (Site::VALID_MIME_TYPES.include?(mime_type) || mime_type =~ /text/) && Site::VALID_EXTENSIONS.include?(File.extname(params[:newfile][:filename]).sub(/^./, ''))
@errors << 'File must me one of the following: HTML, Text, Image (JPG PNG GIF JPEG SVG), JS, CSS, Markdown.'
halt slim(:'site_files/new')
end