Handle empty uploads

This commit is contained in:
Christoph Haas 2018-05-28 16:49:55 +02:00
parent 91a801c445
commit b67ac9d36a

View file

@ -39,6 +39,13 @@ class PackagesController < ApplicationController
@valid_images = []
@invalid_images = []
# If Javascript is disabled a user may submit an empty selection of images.
if params[:file] == nil
flash[:error] = "You have not selected any images."
redirect_to upload_path
return
end
params[:file].each do |img|
new_screenshot = @package.screenshots.new(image: img)