Skip to content

Commit

Permalink
4383 - Move tempfiles from public to tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNigel23 committed Nov 21, 2024
1 parent 7213f0d commit 1ce294b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/controllers/concerns/export_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def export_printable(work, edition, format, preserve_lb, include_metadata, inclu
)

# write the string to a temp directory
temp_dir = File.join(Rails.root, 'public', 'printable')
temp_dir = File.join(Rails.root, 'tmp', 'printable')
Dir.mkdir(temp_dir) unless Dir.exist? temp_dir

time_stub = Time.now.gmtime.iso8601.gsub(/\D/,'')
time_stub = Time.now.gmtime.iso8601.gsub(/\D/, '')
temp_dir = File.join(temp_dir, time_stub)
Dir.mkdir(temp_dir) unless Dir.exist? temp_dir

file_stub = "#{@work.slug.gsub('-','_')}_#{time_stub}"
file_stub = "#{@work.slug.gsub('-', '_')}_#{time_stub}"
md_file = File.join(temp_dir, "#{file_stub}.md")

if format == 'pdf'
Expand All @@ -93,8 +93,6 @@ def export_printable(work, edition, format, preserve_lb, include_metadata, inclu
output_file
end



def export_owner_mailing_list_csv(out:, owner:)
path = "mailing_list.csv"
out.put_next_entry(path)
Expand Down Expand Up @@ -571,7 +569,6 @@ def page_metadata_cells(page)
metadata_cells
end


def index_for_cell(cell)
if cell.transcription_field_id && cell.transcription_field.present?
if cell.transcription_field.input_type == 'spreadsheet'
Expand All @@ -587,7 +584,6 @@ def index_for_cell(cell)
index
end


def cell_data(array, data_cells, transcription_field_flag, count, position, spreadsheet_count)
if transcription_field_flag
result = array.select do |element|
Expand Down Expand Up @@ -788,10 +784,10 @@ def export_notes_as_csv(collection)
]
}

csv = CSV.generate(:headers => true) do |records|
csv = CSV.generate(headers: true) do |records|
records << headers
rows.each do |row|
records << row
records << row
end
end
end
Expand Down

0 comments on commit 1ce294b

Please sign in to comment.