diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-06-03 14:28:43 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-06-03 14:28:43 +0100 |
commit | 0806fcc7d477b45d158e8a152b1f927f395d3aa7 (patch) | |
tree | 3fc0d5028a42c3a9f7971a349d67d90ab071a223 /app/controllers/request_controller.rb | |
parent | 775e122cb4824c9734f50db0dd2967779636080e (diff) |
File.dirname(__FILE__) is not necessarily absolute
It’s weird that there’s so much code here that implicitly
assumes File.dirname(__FILE__) is an absolute path, because
really in general it very much is not! This assumption was
invalidated by the recent bundler-awareness changes.
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 94fbcde29..4592b5ac2 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -839,7 +839,7 @@ class RequestController < ApplicationController ) 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" - file_path = File.join(File.dirname(__FILE__), '../../cache/zips', @url_path) + file_path = File.expand_path(File.join(File.dirname(__FILE__), '../../cache/zips', @url_path)) if !File.exists?(file_path) FileUtils.mkdir_p(File.dirname(file_path)) Zip::ZipFile.open(file_path, Zip::ZipFile::CREATE) { |zipfile| |