(req: FastifyRequest, reply: FastifyReply)
| 12 | str.endsWith('/') ? str.slice(0, -1) : str; |
| 13 | |
| 14 | async function handleRedirects(req: FastifyRequest, reply: FastifyReply) { |
| 15 | const params = getRedirectParams(req); |
| 16 | const { origin, pathPrefix } = params; |
| 17 | const returnTo = trimTrailingSlash(params.returnTo); |
| 18 | const landingUrl = getPrefixedLandingPath(origin, pathPrefix); |
| 19 | |
| 20 | return await reply.redirect( |
| 21 | haveSamePath(landingUrl, returnTo) ? `${returnTo}/learn` : returnTo |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Fastify plugin for dev authentication. |
no test coverage detected