From 3c169ee5fb06cad60e455b45dd9890fded498734 Mon Sep 17 00:00:00 2001 From: "Khang Vo (doublevkay)" <45411113+vovikhangcdv@users.noreply.github.com> Date: Fri, 1 Jul 2022 01:52:03 +0700 Subject: [PATCH] fix file protocol spoofing fix file protocol spoofing --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 91aca3c..483a62e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,7 +37,7 @@ const parsePath = require("parse-path") const parseUrl = (url, normalize = false) => { // Constants - const GIT_RE = /((git@|http(s)?:\/\/)([\w\.@]+)(\/|:))(([\~,\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/ + const GIT_RE = /(^(git@|http(s)?:\/\/)([\w\.@]+)(\/|:))(([\~,\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/ if (typeof url !== "string" || !url.trim()) { const err = new Error("Invalid url.")