MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / proxy

Function proxy

packages/web/src/proxy.ts:26–40  ·  view source on GitHub ↗
(request: NextRequest)

Source from the content-addressed store, hash-verified

24 * See: https://github.com/sourcebot-dev/sourcebot/pull/1076
25 */
26export async function proxy(request: NextRequest) {
27 const url = request.nextUrl.clone();
28
29 if (url.pathname.startsWith('/~/')) {
30 url.pathname = url.pathname.replace(/^\/~/, '');
31 return NextResponse.redirect(url, StatusCodes.MOVED_PERMANENTLY);
32 }
33
34 if (url.pathname === '/~') {
35 url.pathname = '/';
36 return NextResponse.redirect(url, StatusCodes.MOVED_PERMANENTLY);
37 }
38
39 return NextResponse.next();
40}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected