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
9 changes: 9 additions & 0 deletions app/lib/package/api_export/api_exporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ class ApiExporter {

await synchronizePackageNameCompletionData();

await _api.notFound.write({
'error': {
'code': 'NotFound',
'message': 'Package or version requested could not be found.',
},
'code': 'NotFound',
'message': 'Package or version requested could not be found.',
});

await _api.garbageCollect(allPackageNames);
}

Expand Down
9 changes: 9 additions & 0 deletions app/lib/package/api_export/exported_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ final class ExportedApi {
Duration(hours: 8),
);

/// Interface for writing `/api/not-found.json` which is what the bucket will
/// use as 404 response when serving a website.
ExportedJsonFile<Map<String, Object?>> get notFound =>
ExportedJsonFile<Map<String, Object?>>._(
this,
'/not-found.json',
Duration(minutes: 10),
);

/// Run garbage collection on the bucket.
///
/// This will remove all packages from `latest/` and `<runtimeVersion>/`,
Expand Down
Loading