Created
May 15, 2014 15:09
-
-
Save jeremyf/c5fb5d9367a568b2b4b1 to your computer and use it in GitHub Desktop.
Spitballing an adjustment to UC's virus detection
This file contains hidden or 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