Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c9a6ffb authored by Kelvin Zhang's avatar Kelvin Zhang
Browse files

Fix str/bytes type error in ReplaceOtaKeys

ZipFile.read() returns byte sequence, while re.match expects str.
Decode the bytes read first.

Test: th
Bug: 315855025
Change-Id: Id2da071f3caeab56cfac845a9e4f842c4e102f49
parent 5fcaa1f6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1156,9 +1156,9 @@ def WriteOtacerts(output_zip, filename, keys):
  common.ZipWriteStr(output_zip, filename, temp_file.getvalue())


def ReplaceOtaKeys(input_tf_zip, output_tf_zip, misc_info):
def ReplaceOtaKeys(input_tf_zip: zipfile.ZipFile, output_tf_zip, misc_info):
  try:
    keylist = input_tf_zip.read("META/otakeys.txt").split()
    keylist = input_tf_zip.read("META/otakeys.txt").decode().split()
  except KeyError:
    raise common.ExternalError("can't read META/otakeys.txt from input")