diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py index 4f4d4353f..b9ecf6808 100644 --- a/src/common/connection_handlers_events.py +++ b/src/common/connection_handlers_events.py @@ -2072,7 +2072,7 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): if name == 'name': self.file_props.name = val if name == 'size': - self.file_props.size = val + self.file_props.size = int(val) if name == 'hash': self.file_props.algo = child.getAttr('algo') self.file_props.hash_ = val @@ -2112,7 +2112,7 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): if name == 'name': self.file_props.name = val if name == 'size': - self.file_props.size = val + self.file_props.size = int(val) mime_type = si.getAttr('mime-type') if mime_type is not None: self.file_props.mime_type = mime_type diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py index 31aebbf84..b09598eaa 100644 --- a/src/common/jingle_content.py +++ b/src/common/jingle_content.py @@ -193,7 +193,7 @@ class JingleContent(object): else: # if the file is less than 10 mb, then it is small # lets calculate it right away - if int(self.file_props.size) < 10000000 and not \ + if self.file_props.size < 10000000 and not \ self.file_props.hash_: h = self._calcHash() file_tag.addChild(node=h) diff --git a/src/common/socks5.py b/src/common/socks5.py index a8ec1e8fb..d7edd19f9 100644 --- a/src/common/socks5.py +++ b/src/common/socks5.py @@ -646,7 +646,7 @@ class Socks5: self.file_props.last_time self.file_props.last_time = current_time self.file_props.received_len = self.size - if self.size >= int(self.file_props.size): + if self.size >= self.file_props.size: self.state = 8 # end connection self.file_props.error = 0 self.disconnect() @@ -688,7 +688,7 @@ class Socks5: self.file_props.last_time = current_time self.file_props.received_len += lenn self.remaining_buff = '' - if self.file_props.received_len == int(self.file_props.size): + if self.file_props.received_len == self.file_props.size: self.rem_fd(fd) self.disconnect() self.file_props.error = 0 @@ -728,7 +728,7 @@ class Socks5: self.disconnect() self.file_props.error = -6 # file system error return 0 - if self.file_props.received_len >= int(self.file_props.size): + if self.file_props.received_len >= self.file_props.size: # transfer completed self.rem_fd(fd) self.disconnect() diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index 2cac33988..8fd765773 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -407,6 +407,7 @@ class FileTransfersWindow: propose_resume=not dl_finished, on_response=on_response, transient_for=dialog2) dialog.set_destroy_with_parent(True) + return else: dirname = os.path.dirname(file_path) if not os.access(dirname, os.W_OK) and os.name != 'nt': @@ -489,7 +490,7 @@ class FileTransfersWindow: file_props.completed = True text = self._format_percent(100) received_size = int(file_props.received_len) - full_size = int(file_props.size) + full_size = file_props.size text += helpers.convert_bytes(received_size) + '/' + \ helpers.convert_bytes(full_size) self.model.set(iter_, C_PROGRESS, text) @@ -498,7 +499,7 @@ class FileTransfersWindow: self.model.set(iter_, C_PULSE, 1) text = _('Checking file...') + '\n' received_size = int(file_props.received_len) - full_size = int(file_props.size) + full_size = file_props.size text += helpers.convert_bytes(received_size) + '/' + \ helpers.convert_bytes(full_size) self.model.set(iter_, C_PROGRESS, text) @@ -512,7 +513,7 @@ class FileTransfersWindow: elif status == 'hash_error': text = _('File error') + '\n' received_size = int(file_props.received_len) - full_size = int(file_props.size) + full_size = file_props.size text += helpers.convert_bytes(received_size) + '/' + \ helpers.convert_bytes(full_size) self.model.set(iter_, C_PROGRESS, text) @@ -602,7 +603,7 @@ class FileTransfersWindow: Change the progress of a transfer with new transfered size """ file_props = FilesProp.getFilePropByType(typ, sid) - full_size = int(file_props.size) + full_size = file_props.size if full_size == 0: percent = 0 else: @@ -711,7 +712,7 @@ class FileTransfersWindow: file_props.type_ = 's' file_props.desc = file_desc file_props.elapsed_time = 0 - file_props.size = str(stat[6]) + file_props.size = stat[6] file_props.sender = account file_props.receiver = contact file_props.tt_account = account