File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
app/lib/package/api_export Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,15 @@ class ApiExporter {
147147
148148 await synchronizePackageNameCompletionData ();
149149
150+ await _api.notFound.write ({
151+ 'error' : {
152+ 'code' : 'NotFound' ,
153+ 'message' : 'Package or version requested could not be found.' ,
154+ },
155+ 'code' : 'NotFound' ,
156+ 'message' : 'Package or version requested could not be found.' ,
157+ });
158+
150159 await _api.garbageCollect (allPackageNames);
151160 }
152161
Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ final class ExportedApi {
6666 Duration (hours: 8 ),
6767 );
6868
69+ /// Interface for writing `/api/not-found.json` which is what the bucket will
70+ /// use as 404 response when serving a website.
71+ ExportedJsonFile <Map <String , Object ?>> get notFound =>
72+ ExportedJsonFile <Map <String , Object ?>>._(
73+ this ,
74+ '/not-found.json' ,
75+ Duration (minutes: 10 ),
76+ );
77+
6978 /// Run garbage collection on the bucket.
7079 ///
7180 /// This will remove all packages from `latest/` and `<runtimeVersion>/` ,
You can’t perform that action at this time.
0 commit comments