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");
}