correctly open / close file when computing hash
This commit is contained in:
parent
db06bddb81
commit
936d538eba
|
@ -149,12 +149,13 @@ class JingleFileTransfer(JingleContent):
|
||||||
if self.file_props.algo == None:
|
if self.file_props.algo == None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
file_ = open(self.file_props.file_name, 'r')
|
file_ = open(self.file_props.file_name, 'rb')
|
||||||
except:
|
except:
|
||||||
# can't open file
|
# can't open file
|
||||||
return
|
return
|
||||||
h = nbxmpp.Hashes()
|
h = nbxmpp.Hashes()
|
||||||
hash_ = h.calculateHash(self.file_props.algo, file_)
|
hash_ = h.calculateHash(self.file_props.algo, file_)
|
||||||
|
file_.close()
|
||||||
# DEBUG
|
# DEBUG
|
||||||
#hash_ = '1294809248109223'
|
#hash_ = '1294809248109223'
|
||||||
if not hash_:
|
if not hash_:
|
||||||
|
|
Loading…
Reference in New Issue