diff --git a/bskylink/src/routes/createShortLink.ts b/bskylink/src/routes/createShortLink.ts index 411cbb7c67..cc3951525e 100644 --- a/bskylink/src/routes/createShortLink.ts +++ b/bskylink/src/routes/createShortLink.ts @@ -78,7 +78,7 @@ const getUrl = (ctx: AppContext, req: Request, id: string) => { if (!ctx.cfg.service.hostnames.length) { assert(req.headers.host, 'request must be made with host header') const baseUrl = - req.protocol === 'http' && req.headers.host!.startsWith('localhost:') + req.protocol === 'http' && req.headers.host.startsWith('localhost:') ? `http://${req.headers.host}` : `https://${req.headers.host}` return `${baseUrl}/${id}` diff --git a/bskylink/tests/index.ts b/bskylink/tests/index.ts index 8a7f121c92..1b3d06ad19 100644 --- a/bskylink/tests/index.ts +++ b/bskylink/tests/index.ts @@ -173,7 +173,7 @@ describe('link service', async () => { // League of Legends is set to WARN, not BLOCK, so expect a warning (blocked-site div present) assert.match( html, - /"Warning: Malicious Link/, + /Warning: Malicious Link/, 'Expected warning not found in HTML', ) })