From 569e2cec7d9897054394eceb8418c30a36265e58 Mon Sep 17 00:00:00 2001 From: Stefan Rinkes Date: Fri, 16 Jan 2015 16:46:03 +0100 Subject: [PATCH] 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. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cc340b..1587c82 100644 --- a/README.md +++ b/README.md @@ -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