Skip to content

Commit

Permalink
Make sure to open files in binary mode, in order to correctly transfe…
Browse files Browse the repository at this point in the history
…r files on Windows. (lnussbaum/pull/19)
  • Loading branch information
mblsha authored and whitehat101 committed Oct 17, 2013
1 parent 291835d commit 743eea2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/doc/xmpp4r/examples/advanced/recvfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
puts "Waiting for stream configuration"
if stream.accept
puts "Stream established"
outfile = File.new(filename, (offset ? 'a' : 'w'))
outfile = File.new(filename, (offset ? 'ab' : 'wb'))
while buf = stream.read(65536)
outfile.write(buf)
print '.'
Expand Down
2 changes: 1 addition & 1 deletion lib/xmpp4r/bytestreams/helper/filetransfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class FileSource
include TransferSource

def initialize(filename)
@file = File.new(filename)
@file = File.new(filename, "rb")
@filename = filename
@bytes_read = 0
@length = nil
Expand Down

0 comments on commit 743eea2

Please sign in to comment.