Skip to content

Commit a4797e8

Browse files
committed
mirage/crates: Fix error handling for GET /api/v1/crates/:id/downloads request handler
1 parent 2c3f180 commit a4797e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mirage/route-handlers/crates.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ export function register(server) {
155155
server.get('/api/v1/crates/:crate_id/downloads', function(schema, request) {
156156
let crateId = request.params.crate_id;
157157
let crate = schema.crates.find(crateId);
158+
if (!crate) return notFound();
159+
158160
let versionDownloads = schema.versionDownloads
159161
.all()
160162
.filter(it => crate.versions.indexOf(parseInt(it.version, 10)) !== -1);

0 commit comments

Comments
 (0)