Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Spitballing an adjustment to UC's virus detection
class CurationConcern::GenericWorksController < CurationConcern::BaseController
before_filter :rip_out_viral_files, only: [:create, :update]
def rip_out_viral_files
files = attributes_for_actor(:files)
good_files = []
viral_files = []
files.each do |file|
if viral?(file)
viral_files << file
else
good_files << file
end
end
if viral_files.any?
flash[:notice] = "We found viruses in the files you uploaded"
end
attributes_for_actor(:files) = good_files
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.