Merge "Run ZipFile.testzip() during zipfile tests."
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 6e0fefc..b71baf9 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -349,8 +349,9 @@
partition = itemset.partition
for info in input_zip.infolist():
- if info.filename.startswith(partition.upper() + "/"):
- basefilename = info.filename[7:]
+ prefix = partition.upper() + "/"
+ if info.filename.startswith(prefix):
+ basefilename = info.filename[len(prefix):]
if IsSymlink(info):
symlinks.append((input_zip.read(info.filename),
"/" + partition + "/" + basefilename))
@@ -663,7 +664,7 @@
prefix = partition.upper() + "/"
for info in z.infolist():
if info.filename.startswith(prefix) and not IsSymlink(info):
- basefilename = info.filename[7:]
+ basefilename = info.filename[len(prefix):]
fn = partition + "/" + basefilename
data = z.read(info.filename)
out[fn] = common.File(fn, data)