summaryrefslogtreecommitdiff
path: root/tftpy
diff options
context:
space:
mode:
author¨Andreas <¨andreas.dachsberger@gmail.com¨>2018-09-10 13:28:37 +0200
committer¨Andreas <¨andreas.dachsberger@gmail.com¨>2018-09-10 13:28:37 +0200
commit57dc3d3e03bb60f6ea6cc861d83cc565d4e1eef9 (patch)
tree581ccb1dd3c9eec7576ec70bf653d330baa22f3c /tftpy
parentb44658c6081a90618d693c4b5a5badbbc7b8f9a5 (diff)
downloadtftpy-57dc3d3e03bb60f6ea6cc861d83cc565d4e1eef9.tar.gz
Compatibility tested
Tested compatibility with easy test client and test server. So far, no errors anymore. (In Both python2 and python3) Just tested basic functionality!
Diffstat (limited to 'tftpy')
-rw-r--r--tftpy/TftpPacketTypes.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tftpy/TftpPacketTypes.py b/tftpy/TftpPacketTypes.py
index e26563e..07871e4 100644
--- a/tftpy/TftpPacketTypes.py
+++ b/tftpy/TftpPacketTypes.py
@@ -124,8 +124,10 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
tftpassert(self.filename, "filename required in initial packet")
tftpassert(self.mode, "mode required in initial packet")
# Make sure filename and mode are bytestrings.
- self.filename = self.filename.encode('ascii')
- self.mode = self.mode.encode('ascii')
+ if not isinstance(self.filename, bytes):
+ self.filename = self.filename.encode('ascii')
+ if not isinstance(self.mode, bytes):
+ self.mode = self.mode.encode('ascii')
ptype = None
if self.opcode == 1: ptype = "RRQ"