Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge 6a627fc into 0e50795
Browse files Browse the repository at this point in the history
  • Loading branch information
penn5 committed Jun 21, 2019
2 parents 0e50795 + 6a627fc commit 728fdc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adb/fastboot.py
Expand Up @@ -312,13 +312,13 @@ def Download(self, source_file, source_len=0,
"""
if isinstance(source_file, str):
source_len = os.stat(source_file).st_size
source_file = open(source_file)
source_file = open(source_file, "rb")

with source_file:
if source_len == 0:
# Fall back to storing it all in memory :(
data = source_file.read()
source_file = io.BytesIO(data.encode('utf8'))
source_file = io.BytesIO(data if isinstance(data, bytes) else data.encode("utf-8"))
source_len = len(data)

self._protocol.SendCommand(b'download', b'%08x' % source_len)
Expand Down

0 comments on commit 728fdc1

Please sign in to comment.