fix: use forward slashes in AAB ZIP entries on Windows (#3624)
This commit is contained in:
@@ -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',
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user