aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-12-13 20:15:54 +0000
committerLouise Crow <louise.crow@gmail.com>2012-12-13 20:15:54 +0000
commitd2dc193066222b279faa52a66a22760e739dd87e (patch)
tree603a0437ac502b827c9b08eb5c1d3764ed72ce1d /app/controllers/request_controller.rb
parent611411fc7907a97e3aa8c2339bc9f5b70a5d1a01 (diff)
Put download zips in a predictable location - sharded folders based on request ID, rather than distributing them across the download directories by the generated SHA. Preserve the uniqueness of the subdirectory.
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 42cfa11c6..d8c34c2dd 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -882,7 +882,10 @@ class RequestController < ApplicationController
:info_request_title=>@info_request.title)
)
updated = Digest::SHA1.hexdigest(@info_request.get_last_event.created_at.to_i.to_s + @info_request.updated_at.to_i.to_s)
- @url_path = "/download/#{updated[0..1]}/#{updated}/#{params[:url_title]}.zip"
+ @url_path = File.join("/download",
+ request_dirs(@info_request),
+ updated,
+ "#{params[:url_title]}.zip")
file_path = File.expand_path(File.join(download_zip_dir(), @url_path))
if !File.exists?(file_path)
FileUtils.mkdir_p(File.dirname(file_path))