File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,23 @@ export default {
3
3
const r = await env . ASSETS . fetch ( request )
4
4
if ( r . status == 404 ) {
5
5
const url = new URL ( request . url )
6
+ const redirectPath = redirect ( url . pathname )
7
+ if ( redirectPath ) {
8
+ url . pathname = redirectPath
9
+ return Response . redirect ( url . toString ( ) , 301 )
10
+ }
6
11
url . pathname = '/404.html'
7
12
const r = await env . ASSETS . fetch ( url )
8
13
return new Response ( r . body , { status : 404 } )
9
14
}
10
15
return r
11
16
} ,
12
17
} satisfies ExportedHandler < Env >
18
+
19
+ const redirect_lookup : Record < string , string > = {
20
+ '/common_tools/' : '/common-tools/' ,
21
+ }
22
+
23
+ function redirect ( pathname : string ) : string | null {
24
+ return redirect_lookup [ pathname ] ?? null
25
+ }
File renamed without changes.
Original file line number Diff line number Diff line change 20
20
- models.md
21
21
- dependencies.md
22
22
- tools.md
23
- - common_tools .md
23
+ - common-tools .md
24
24
- results.md
25
25
- message-history.md
26
26
- testing-evals.md
You can’t perform that action at this time.
0 commit comments