Skip to content

Instantly share code, notes, and snippets.

@jeremyf
Created May 15, 2014 15:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jeremyf/c5fb5d9367a568b2b4b1 to your computer and use it in GitHub Desktop.
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