Skip to content

Commit 945f130

Browse files
committed
Fix redirect link to calendar
1 parent 48b9650 commit 945f130

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/calendar.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export default function calendarRouter(domain: string): express.Router {
1919
const token = req.cookies.token;
2020
const requestLogin = mkRequestLogin(res);
2121
if (token && (await new Strava(domain, token, requestLogin).hasToken())) {
22-
const path = req.get('Host') + req.originalUrl.replace(/\/?$/, '/');
23-
const fullPath = `webcal://${path}${req.cookies.token}.ics`;
22+
const webcalDomain = domain.replace(/\w+(?=:\/\/)/, 'webcal');
23+
const pathWithSlash = req.originalUrl.replace(/\/?$/, '/');
24+
const fullPath = webcalDomain + pathWithSlash + token + '.ics';
2425
res.redirect(fullPath);
2526
} else {
2627
await requestLogin();

0 commit comments

Comments
 (0)