Skip to content

Commit a119081

Browse files
authored
Check if exposure is limited in test 404 page (#2351)
1 parent c363cc0 commit a119081

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app.ts

+5
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ app.all(/\/tests\/(.*)/, (req: Request, res: Response) => {
482482
ident,
483483
suggestion: tests.didYouMean(ident),
484484
query: querystring.encode(req.query as any),
485+
queryNoExposure: querystring.encode({
486+
...req.query,
487+
exposure: undefined,
488+
} as any),
489+
exposure: req.query.exposure,
485490
});
486491
}
487492
});

views/testnotfound.ejs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ See the LICENSE file for copyright details
99
<%- contentFor('body') %>
1010
<h1>Test Not Found</h1>
1111
<p>Could not find a test for <code><%= ident %></code>.
12-
<% if (suggestion) { %>
12+
<% if (exposure) { %>
13+
<span class="notice">Tests are limited to the <code><%= exposure %></code> exposure; why not try with <a href="/tests/<%= `${ident}${query ? `?${queryNoExposure}`: ''}` %>">any exposure</a>?</span>
14+
<% } else if (suggestion) { %>
1315
<span class="notice">Did you mean <a href="/tests/<%= `${suggestion.replace(/\./g, '/')}${query ? `?${query}`: ''}` %>"><code><%= suggestion %></code></a>?</span>
1416
<% } %>
1517
</p>

0 commit comments

Comments
 (0)