Read/Write file in binary mode

This commit is contained in:
Philipp Hörist 2017-03-29 17:56:03 +02:00
parent fde2ac731b
commit 21700051f8
2 changed files with 3 additions and 3 deletions

View File

@ -146,7 +146,7 @@ class StateTransfering(JingleFileTransferStates):
def _start_ibb_transfer(self, con):
self.jft.file_props.transport_sid = self.jft.transport.sid
fp = open(self.jft.file_props.file_name, 'r')
fp = open(self.jft.file_props.file_name, 'rb')
con.OpenStream(self.jft.file_props.sid, self.jft.session.peerjid, fp,
blocksize=4096)

View File

@ -251,7 +251,7 @@ class ConnectionBytestream:
if field.getValue() == nbxmpp.NS_IBB:
sid = file_props.sid
file_props.transport_sid = sid
fp = open(file_props.file_name, 'r')
fp = open(file_props.file_name, 'rb')
self.OpenStream(sid, file_props.receiver, fp)
raise nbxmpp.NodeProcessed
@ -815,7 +815,7 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props.disconnect_cb = None
file_props.continue_cb = None
file_props.syn_id = stanza.getID()
file_props.fp = open(file_props.file_name, 'w')
file_props.fp = open(file_props.file_name, 'wb')
conn.send(rep)
def CloseIBBStream(self, file_props):