Print data instead of puts

Zipping a directory with the old example would change the content of a file by adding a newline to the data getting zipped.
This is bad if you want to validate files of zip with checksums or, in my case, corrupt git index files if you zip a git-directory.
This commit is contained in:
Stefan Rinkes 2015-01-16 16:46:03 +01:00
parent deeefa1b1a
commit 569e2cec7d
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ class ZipFileGenerator
subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
writeEntries(subdir, zipFilePath, io)
else
io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
io.get_output_stream(zipFilePath) { |f| f.print(File.open(diskFilePath, "rb").read())}
end
}
end