summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/files_controller.rb1
-rw-r--r--app/uploaders/attachment_uploader.rb6
2 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index f13a543cfdd..09f1e5512d6 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -1,7 +1,6 @@
class FilesController < ApplicationController
def download
uploader = Note.find(params[:id]).attachment
- uploader.retrieve_from_store!(params[:filename])
send_file uploader.file.path, disposition: 'attachment'
end
end
diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb
index 3dd2117e339..200700b8810 100644
--- a/app/uploaders/attachment_uploader.rb
+++ b/app/uploaders/attachment_uploader.rb
@@ -21,6 +21,10 @@ class AttachmentUploader < CarrierWave::Uploader::Base
end
def secure_url
- "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
+ if self.class.storage == CarrierWave::Storage::File
+ "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
+ else
+ url
+ end
end
end