소스 검색

Fix redirecting to wrong target. Closes #65

Pouria Ezzati 7 년 전
부모
커밋
8892cba7e4
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      server/controllers/urlController.js

+ 1 - 1
server/controllers/urlController.js

@@ -101,7 +101,7 @@ exports.goToUrl = async (req, res, next) => {
   const isBot =
     botList.some(bot => agent.source.toLowerCase().includes(bot)) || agent.family === 'Other';
   if (!urls && !urls.length) return next();
-  const [url] = urls;
+  const url = urls.find(item => (domain ? item.domain === domain : !item.domain));
   if (url.password && !req.body.password) {
     req.protectedUrl = id;
     return next();