Source: redmine
Version: 4.0.4-3~bpo10+1
Tags: patch

The debian package ships redmine in /usr/share/redmine and sets up
instances in /var/lib/redmine.

Without this change the issue importer attempts to create a directory in
the read-only /usr tree:
Completed 500 Internal Server Error
Errno::EACCES (Permission denied @ dir_s_mkdir - /usr/share/redmine/tmp):

Now it uses the intended tmp directory and issues can be imported again:
/var/lib/redmine/default/tmp/imports/350548aee641641463bc89cd6043738c
>From ee9b172effe5ffc64a15f84b393923d6fb66d99b Mon Sep 17 00:00:00 2001
From: Andre Heider <a.hei...@gmail.com>
Date: Sun, 23 Feb 2020 16:50:58 +0100
Subject: [PATCH] Fix importing issues due to using the wrong tmp directory

The debian package ships redmine in /usr/share/redmine and sets up
instances in /var/lib/redmine.

Without this change the issue importer attempts to create a directory in
the read-only /usr tree:
Completed 500 Internal Server Error
Errno::EACCES (Permission denied @ dir_s_mkdir - /usr/share/redmine/tmp):

Now it uses the intended tmp directory and issues can be imported again:
/var/lib/redmine/default/tmp/imports/350548aee641641463bc89cd6043738c
---
 app/models/import.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/import.rb b/app/models/import.rb
index 7f2715bdb..3efdea53b 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -103,7 +103,7 @@ class Import < ActiveRecord::Base
   # It is stored in tmp/imports with a random hex as filename
   def filepath
     if filename.present? && /\A[0-9a-f]+\z/.match?(filename)
-      File.join(Rails.root, "tmp", "imports", filename)
+      File.join(Redmine.root, "tmp", "imports", filename)
     else
       nil
     end
-- 
2.25.0

Reply via email to