未验证 提交 d5c1addd 编写于 作者: J Joe Haddad 提交者: GitHub

Simplify trailing slash regex (#15335)

上级 c40f407d
......@@ -360,13 +360,13 @@ export default async function loadCustomRoutes(
if (config.trailingSlash) {
redirects.unshift(
{
source: '/:path*/:file.:ext/',
destination: '/:path*/:file.:ext',
source: '/:file((?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
permanent: true,
},
{
source: '/:path*/:notfile([^/.]+)',
destination: '/:path*/:notfile/',
source: '/:notfile((?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
permanent: true,
}
)
......
......@@ -258,13 +258,13 @@ describe('Trailing slashes', () => {
expect.objectContaining({
redirects: expect.arrayContaining([
expect.objectContaining({
source: '/:path*/:file.:ext/',
destination: '/:path*/:file.:ext',
source: '/:file((?:[^/]+/)*[^/]+\\.\\w+)/',
destination: '/:file',
statusCode: 308,
}),
expect.objectContaining({
source: '/:path*/:notfile([^/.]+)',
destination: '/:path*/:notfile/',
source: '/:notfile((?:[^/]+/)*[^/\\.]+)',
destination: '/:notfile/',
statusCode: 308,
}),
]),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册