Spitballing an adjustment to UC's virus detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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