Merge pull request #6380 from betagouv/move-bugreport
archives: move bugreport
This commit is contained in:
commit
11815fd2e6
2 changed files with 7 additions and 3 deletions
|
@ -27,7 +27,7 @@ class ProcedureArchiveService
|
|||
Zip::OutputStream.open(tmp_file) do |zipfile|
|
||||
bug_reports = ''
|
||||
files.each do |attachment, pj_filename|
|
||||
zipfile.put_next_entry("procedure-#{@procedure.id}/#{pj_filename}")
|
||||
zipfile.put_next_entry("#{zip_root_folder(@procedure)}/#{pj_filename}")
|
||||
begin
|
||||
zipfile.puts(attachment.download)
|
||||
rescue
|
||||
|
@ -35,7 +35,7 @@ class ProcedureArchiveService
|
|||
end
|
||||
end
|
||||
if !bug_reports.empty?
|
||||
zipfile.put_next_entry("LISEZMOI.txt")
|
||||
zipfile.put_next_entry("#{zip_root_folder(@procedure)}/LISEZMOI.txt")
|
||||
zipfile.puts(bug_reports)
|
||||
end
|
||||
end
|
||||
|
@ -58,6 +58,10 @@ class ProcedureArchiveService
|
|||
|
||||
private
|
||||
|
||||
def zip_root_folder(procedure)
|
||||
"procedure-#{@procedure.id}"
|
||||
end
|
||||
|
||||
def create_list_of_attachments(dossiers)
|
||||
dossiers.flat_map do |dossier|
|
||||
ActiveStorage::DownloadableFile.create_list_from_dossier(dossier)
|
||||
|
|
|
@ -90,7 +90,7 @@ describe ProcedureArchiveService do
|
|||
archive.file.open do |f|
|
||||
files = ZipTricks::FileReader.read_zip_structure(io: f)
|
||||
expect(files.size).to be 4
|
||||
expect(files.last.filename).to include("LISEZMOI")
|
||||
expect(files.last.filename).to eq("procedure-#{procedure.id}/LISEZMOI.txt")
|
||||
expect(extract(f, files.last)).to match(/Impossible de .*cni.*png/)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue