Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
AppEngine version, listed here to ease deployment and troubleshooting.

## Next Release (replace with git tag when deployed)
* Note: accepted uncompressed archive total size is increased to 256 MiB.

## `20251120t084200-all`
* Bump runtimeVersion to `2025.11.18`.
Expand Down
7 changes: 5 additions & 2 deletions pkg/pub_package_reader/lib/pub_package_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ Future<PackageSummary> summarizePackageArchive(
/// The maximum length of the extracted content text.
int maxContentLength = 256 * 1024,

/// The maximum file size of the archive (gzipped or compressed) and
/// the maximum total size of the files inside the archive.
/// The maximum file size of the archive (compressed).
int maxArchiveSize = 100 * 1024 * 1024,

/// The maximum total size of the files inside the archive.
int maxUncompressedSize = 256 * 1024 * 1024,

/// The maximum number of files in the archive.
/// TODO: set this lower once we scan the existing archives
int maxFileCount = 64 * 1024,
Expand All @@ -102,6 +104,7 @@ Future<PackageSummary> summarizePackageArchive(
await scanArchiveSurface(
archivePath,
maxArchiveSize: maxArchiveSize,
maxUncompressedSize: maxUncompressedSize,
).toList(),
);
if (issues.isNotEmpty) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/pub_package_reader/lib/src/archive_surface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:pub_package_reader/pub_package_reader.dart' show ArchiveIssue;
Stream<ArchiveIssue> scanArchiveSurface(
String archivePath, {
required int maxArchiveSize,
required int maxUncompressedSize,
}) async* {
// Some platforms may not be able to create an archive, only an empty file.
final file = File(archivePath);
Expand Down Expand Up @@ -43,9 +44,9 @@ Stream<ArchiveIssue> scanArchiveSurface(
if (uncompressedLength <= 0) {
yield ArchiveIssue('Uncompressed archive is empty (size = 0).');
return;
} else if (uncompressedLength > maxArchiveSize) {
} else if (uncompressedLength > maxUncompressedSize) {
yield ArchiveIssue(
'Uncompressed package archive is too large (size > $maxArchiveSize).',
'Uncompressed package archive is too large (size > $maxUncompressedSize).',
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pub_package_reader/test/archive_surface_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void main() {

final summary = await summarizePackageArchive(
archiveFile.path,
maxArchiveSize: 199999,
maxUncompressedSize: 199999,
);
expect(summary.issues, isNotEmpty);
expect(
Expand Down