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
This commit is contained in:
Kelvin Zhang
2024-09-04 17:03:24 -07:00
parent 5fcaa1f635
commit 0c9a6ffb00

View File

@@ -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")