aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorLuc Donnet2015-05-07 14:40:37 +0200
committerLuc Donnet2015-05-07 14:40:37 +0200
commit73abd85f6181e33fe0b2fe31a5c46f2fbc44eb8a (patch)
treef284e3994937c1e58a68625dc347a0ad7d557945 /app/controllers
parent46c9cd634a1b2f36df872bd0acbca25884673810 (diff)
downloadchouette-core-73abd85f6181e33fe0b2fe31a5c46f2fbc44eb8a.tar.bz2
Fix import
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/exports_controller.rb2
-rw-r--r--app/controllers/imports_controller.rb6
2 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index b41ce1ca0..68ee00568 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -5,7 +5,7 @@ class ExportsController < ChouetteController
defaults :resource_class => Export
respond_to :html, :only => [:show, :index, :destroy, :exported_file]
- respond_to :js, :only => [:show, :index]
+ respond_to :js, :only => [:index]
belongs_to :referential
def index
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 752c08f5b..3b02c9026 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -6,7 +6,7 @@ class ImportsController < ChouetteController
defaults :resource_class => Import
respond_to :html, :only => [:show, :index, :destroy, :imported_file, :rule_parameter_set, :compliance_check]
- respond_to :js, :only => [:show, :index, :compliance_check]
+ respond_to :js, :only => [:index, :compliance_check]
belongs_to :referential
def index
@@ -44,6 +44,10 @@ class ImportsController < ChouetteController
end
def imported_file
+ # WARNING : files under 10kb in size get treated as StringIO by OpenUri
+ # http://stackoverflow.com/questions/10496874/why-does-openuri-treat-files-under-10kb-in-size-as-stringio
+ OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
+ OpenURI::Buffer.const_set 'StringMax', 0
begin
send_file open(resource.file_path), { :type => "application/#{resource.filename_extension}", :disposition => "attachment", :filename => resource.filename }
rescue Ievkit::Error => error