about summary refs log tree commit diff
path: root/app/controllers/admin/export_domain_allows_controller.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-17 11:42:20 +0100
committerGitHub <noreply@github.com>2022-11-17 11:42:20 +0100
commitab7d99e035f5b880ef77440e7c2e76f8e8728992 (patch)
tree90b4fed3f19bbe4eaa9ad43444260c9e84236119 /app/controllers/admin/export_domain_allows_controller.rb
parent23ea0e75080e427e5ec6be08f7fa75fc8508cd94 (diff)
Fix various issues with domain block import (#1944)
- stop using Paperclip for processing domain allow/block imports
- stop leaving temporary files
- better error handling
- assume CSV files are UTF-8-encoded
Diffstat (limited to 'app/controllers/admin/export_domain_allows_controller.rb')
-rw-r--r--app/controllers/admin/export_domain_allows_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/admin/export_domain_allows_controller.rb b/app/controllers/admin/export_domain_allows_controller.rb
index eb2955ac3..57fb12c62 100644
--- a/app/controllers/admin/export_domain_allows_controller.rb
+++ b/app/controllers/admin/export_domain_allows_controller.rb
@@ -8,8 +8,6 @@ module Admin
 
     before_action :set_dummy_import!, only: [:new]
 
-    ROWS_PROCESSING_LIMIT = 20_000
-
     def new
       authorize :domain_allow, :create?
     end
@@ -23,9 +21,11 @@ module Admin
       authorize :domain_allow, :create?
       begin
         @import = Admin::Import.new(import_params)
+        return render :new unless @import.validate
+
         parse_import_data!(export_headers)
 
-        @data.take(ROWS_PROCESSING_LIMIT).each do |row|
+        @data.take(Admin::Import::ROWS_PROCESSING_LIMIT).each do |row|
           domain = row['#domain'].strip
           next if DomainAllow.allowed?(domain)