mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
Merge pull request #1452 from okriuchykhin/ok_SCI_2950
Fix binary files in Export All archive [SCI-2950]
This commit is contained in:
commit
88cea198f0
1 changed files with 3 additions and 9 deletions
|
@ -193,12 +193,7 @@ class TeamZipExport < ZipExport
|
|||
name = "#{directory}/#{append_file_suffix(asset.file_file_name,
|
||||
"_#{i}")}"
|
||||
end
|
||||
file = FileUtils.touch(name).first
|
||||
if asset.file.exists?
|
||||
File.open(file, 'wb') do |f|
|
||||
f.write(Paperclip.io_adapters.for(asset.file).read)
|
||||
end
|
||||
end
|
||||
asset.file.copy_to_local_file(:original, name) if asset.file.exists?
|
||||
asset_indexes[asset.id] = name
|
||||
end
|
||||
|
||||
|
@ -266,8 +261,7 @@ class TeamZipExport < ZipExport
|
|||
|
||||
# Save all attachments (it doesn't work directly in callback function
|
||||
assets.each do |asset, asset_path|
|
||||
file = FileUtils.touch(asset_path).first
|
||||
File.open(file, 'wb') { |f| f.write asset.open.read }
|
||||
asset.file.copy_to_local_file(:original, asset_path)
|
||||
end
|
||||
|
||||
csv_file_path
|
||||
|
@ -301,7 +295,7 @@ class TeamZipExport < ZipExport
|
|||
write_entries(input_dir, subdir, zip_file_path, io)
|
||||
else
|
||||
io.get_output_stream(zip_file_path) do |f|
|
||||
f.puts File.open(disk_file_path, 'rb').read
|
||||
f.write(File.open(disk_file_path, 'rb').read)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue