Hardcoded file path separators
This commit is contained in:
parent
86a342d990
commit
1f95122829
@ -157,7 +157,7 @@ class DmsfController < ApplicationController
|
||||
render_404 #and return
|
||||
rescue DmsfAccessError
|
||||
render_403 # and return
|
||||
rescue Exception => e
|
||||
rescue StandardError => e
|
||||
flash[:error] = e.message
|
||||
Rails.logger.error e.message
|
||||
end
|
||||
@ -423,7 +423,7 @@ class DmsfController < ApplicationController
|
||||
:filename => filename_for_content_disposition("#{@project.name}-#{DateTime.now.strftime('%y%m%d%H%M%S')}.zip"),
|
||||
:type => 'application/zip',
|
||||
:disposition => 'attachment')
|
||||
rescue Exception
|
||||
rescue StandardError
|
||||
raise
|
||||
ensure
|
||||
zip.close if zip
|
||||
@ -447,7 +447,7 @@ class DmsfController < ApplicationController
|
||||
unless (file.project == @project) || User.current.allowed_to?(:view_dmsf_files, file.project)
|
||||
raise DmsfAccessError
|
||||
end
|
||||
zip.add_file(file, member, (file.dmsf_folder.dmsf_path_str if file.dmsf_folder)) if file
|
||||
zip.add_file(file, member, (file.dmsf_folder.dmsf_path_str if file.dmsf_folder))
|
||||
end
|
||||
max_files = Setting.plugin_redmine_dmsf['dmsf_max_file_download'].to_i
|
||||
if max_files > 0 && zip.files.length > max_files
|
||||
|
||||
@ -43,7 +43,10 @@ class DmsfZip
|
||||
|
||||
def add_file(file, member, root_path = nil)
|
||||
unless @files.include?(file)
|
||||
string_path = file.dmsf_folder.nil? ? '' : "#{file.dmsf_folder.dmsf_path_str}/"
|
||||
unless file && file.last_revision && File.exist?(file.last_revision.disk_file)
|
||||
raise FileNotFound
|
||||
end
|
||||
string_path = file.dmsf_folder.nil? ? '' : (file.dmsf_folder.dmsf_path_str + File::SEPARATOR)
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty?
|
||||
string_path += file.formatted_name(member.dmsf_title_format)
|
||||
@ -64,7 +67,7 @@ class DmsfZip
|
||||
|
||||
def add_folder(folder, member, root_path = nil)
|
||||
unless @folders.include?(folder)
|
||||
string_path = "#{folder.dmsf_path_str}/"
|
||||
string_path = folder.dmsf_path_str + File::SEPARATOR
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
zip_entry = ::Zip::Entry.new(@zip_file, string_path, nil, nil, nil, nil, nil, nil,
|
||||
::Zip::DOSTime.at(folder.modified))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user