You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2017/12/13 20:16:45 UTC
[whimsy] branch master updated: No point pre-reading file if it is
.gz format
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 83f0f01 No point pre-reading file if it is .gz format
83f0f01 is described below
commit 83f0f01b60e802fda2550f8d8fdf4257f44f1e50
Author: Sebb <se...@apache.org>
AuthorDate: Wed Dec 13 20:16:34 2017 +0000
No point pre-reading file if it is .gz format
---
tools/mboxhdr2csv.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/mboxhdr2csv.rb b/tools/mboxhdr2csv.rb
index 368e752..74f9fa4 100644
--- a/tools/mboxhdr2csv.rb
+++ b/tools/mboxhdr2csv.rb
@@ -21,13 +21,14 @@ MBOX_EXT = '.mbox'
# Read f.mbox or f.mbox.gz and return [message, message2, ...] or raise error
def read_mbox(f)
- mbox = File.read(f)
if f.end_with? '.gz'
stream = StringIO.new(mbox)
reader = Zlib::GzipReader.new(stream)
mbox = reader.read
reader.close
stream.close rescue nil
+ else
+ mbox = File.read(f)
end
mbox.force_encoding Encoding::ASCII_8BIT
messages = mbox.split(/^From .*/)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].