fix: use forward slashes in AAB ZIP entries on Windows (#3624)

This commit is contained in:
Eric Seidel
2026-02-23 19:06:29 -08:00
committed by GitHub
parent 2904eb8766
commit 4175399623
3 changed files with 38 additions and 3 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ environment:
sdk: ">=3.9.0 <4.0.0"
dependencies:
archive: ^4.0.7
archive: ^4.0.8
args: ^2.7.0
checked_yaml: ^2.0.4
cli_completion: ^0.5.0
@@ -139,6 +139,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync(yamlContents);
// Include AndroidManifest.xml to match real AAB structure.
File(
p.join(
aabDirectory.path,
'base',
'manifest',
'AndroidManifest.xml',
),
)
..createSync(recursive: true)
..writeAsStringSync('<manifest />');
await ZipFileEncoder().zipDirectory(aabDirectory, filename: aabPath());
return File(aabPath());
@@ -802,6 +814,29 @@ app_id: $appId
channel: ${track.channel}
''');
});
test('re-zipped AAB uses forward slashes in entry names', () async {
aabFile = await createAabFile(channel: 'dev');
await runWithOverrides(
() => command.setChannelOnAab(
aabFile: aabFile,
channel: track.channel,
),
);
// Verify all ZIP entry names use forward slashes per the
// ZIP spec. On Windows, without normalization, entries would
// contain backslashes which breaks bundletool.
final bytes = aabFile.readAsBytesSync();
final archive = ZipDecoder().decodeBytes(bytes);
for (final file in archive.files) {
expect(
file.name,
isNot(contains(r'\')),
reason: 'ZIP entry "${file.name}" contains backslash',
);
}
});
});
});