未验证 提交 c1702c23 编写于 作者: C Connor Davis 提交者: GitHub

Exclude well known files when trailing slash: true (#19364)

* Exclude well known files when trailing slash: true

* Update manifest test
Co-authored-by: NJJ Kasper <jj@jjsweb.site>
上级 26634c47
......@@ -388,13 +388,13 @@ export default async function loadCustomRoutes(
if (config.trailingSlash) {
redirects.unshift(
{
source: '/:file((?:[^/]+/)*[^/]+\\.\\w+)/',
source: '/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
permanent: true,
locale: config.i18n ? false : undefined,
},
{
source: '/:notfile((?:[^/]+/)*[^/\\.]+)',
source: '/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
permanent: true,
locale: config.i18n ? false : undefined,
......
......@@ -291,12 +291,13 @@ describe('Trailing slashes', () => {
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source: '/:file((?:[^/]+/)*[^/]+\\.\\w+)/',
source:
'/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
statusCode: 308,
}),
expect.objectContaining({
source: '/:notfile((?:[^/]+/)*[^/\\.]+)',
source: '/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
statusCode: 308,
}),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册