fix: exclude localhost

This commit is contained in:
Namekuji 2023-08-18 05:01:19 -04:00
parent 5520c6ff3d
commit cd75d65271
No known key found for this signature in database
GPG Key ID: 1D62332C07FBA532

View File

@ -41,7 +41,8 @@ export async function uploadFromUrl({
const parsedUrl = new URL(url);
if (
process.env.NODE_ENV === "production" &&
PRIVATE_IP.test(parsedUrl.hostname)
(PRIVATE_IP.test(parsedUrl.hostname) ||
parsedUrl.hostname.includes("localhost"))
) {
throw new Error("Private IP is not allowed");
}