forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#30744 from github/repo-sync
Repo sync
- Loading branch information
Showing
6 changed files
with
11 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,6 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) => | |
const req = context.req as any | ||
const res = context.res as any | ||
|
||
const version = req.context.currentVersion | ||
|
||
const searchVersion = req.context.searchVersions[Array.isArray(version) ? version[0] : version] | ||
if (!searchVersion) { | ||
// E.g. someone loaded `/en/[email protected]/search` | ||
// That's going to 404 in the XHR later but it simply shouldn't be | ||
// a valid starting page. | ||
return { | ||
notFound: true, | ||
} | ||
} | ||
|
||
const mainContext = await getMainContext(req, res) | ||
addUINamespaces(req, mainContext.data.ui, ['search_results']) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { expect, jest } from '@jest/globals' | ||
|
||
import { getDOM } from '#src/tests/helpers/e2etest.js' | ||
import { get, getDOM } from '#src/tests/helpers/e2etest.js' | ||
|
||
describe('search results page', () => { | ||
jest.setTimeout(5 * 60 * 1000) | ||
|
@@ -27,4 +27,11 @@ describe('search results page', () => { | |
expect(h1Text).toMatch(/peterbe/) | ||
expect($('title').text()).toMatch(/Search results for "peterbe"/) | ||
}) | ||
|
||
test('invalid version prefix 404s', async () => { | ||
const res = await get( | ||
`/en/[email protected]/search?${new URLSearchParams({ query: 'peterbe' })}`, | ||
) | ||
expect(res.statusCode).toBe(404) | ||
}) | ||
}) |