diff options
author | poeti8 <ezzati.upt@gmail.com> | 2020-05-31 15:35:28 +0300 |
---|---|---|
committer | poeti8 <ezzati.upt@gmail.com> | 2020-05-31 15:35:28 +0300 |
commit | 506c43dfcdb97c9bf930cad36493bd6eb98ecbc7 (patch) | |
tree | 0fcaf18ec5151caca72cf33ff63decdf0c16dd5b /server | |
parent | e8a0d81b314150242a7539df22e7a62c4ac90bfa (diff) |
fix: error when domain is undefined
Diffstat (limited to 'server')
-rw-r--r-- | server/handlers/links.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/handlers/links.ts b/server/handlers/links.ts index ec55c61..f14db01 100644 --- a/server/handlers/links.ts +++ b/server/handlers/links.ts @@ -115,7 +115,7 @@ export const edit: Handler = async (req, res) => { } const targetDomain = URL.parse(target).hostname; - const domain_id = link.domain_id; + const domain_id = link.domain_id || null; const queries = await Promise.all([ validators.cooldown(req.user), @@ -265,7 +265,7 @@ export const redirect = (app: ReturnType<typeof next>): Handler => async ( const address = req.params.id.replace("+", ""); const link = await query.link.find({ address, - domain_id: domain && domain.id + domain_id: domain ? domain.id : null }); // 3. When no link, if has domain redirect to domain's homepage |