Do not throw error when IP is not valid

parent 742b2ede
......@@ -15,9 +15,10 @@ function catcher(x) {
*/
router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
const ipAddress = req.params.ip;
const compressedIp = compressIp(ipAddress);
if(isIp(ipAddress)) {
const compressedIp = compressIp(ipAddress);
if(compressedIp != ipAddress) {
res.redirect(301, `/ip/${compressedIp}`);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment