Skip to content

Commit 777cf9b

Browse files
committed
fix
1 parent d960fe1 commit 777cf9b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

aws/viewer-request/index.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,9 @@ function compute(path) {
122122

123123
// Version removal
124124
const match = path.match(/^\/docs\/(?:surrealdb\/)?([^\/]+)(\/.*)?$/);
125-
if (match) {
126-
const [,, section, rest] = match;
127-
if (versions.includes(section)) {
128-
// biome-ignore lint/style/noParameterAssign:
129-
path = `/docs/surrealdb${rest || ''}`;
130-
}
125+
if (match && versions.includes(match[1])) {
126+
// biome-ignore lint/style/noParameterAssign:
127+
path = `/docs/surrealdb${match[2] || ''}`;
131128
}
132129

133130
// Prefixed redirects
@@ -169,7 +166,7 @@ function handler(event) {
169166
// Do we redirect to fix the URL first?
170167
if (
171168
host !== 'surrealdb.com' ||
172-
(!computed.raw && computed.path !== request.uri)
169+
(!computed.raw && (computed.path !== request.uri))
173170
) {
174171
return {
175172
statusCode: 301,

0 commit comments

Comments
 (0)