From 99b1def5df2b6d9654dbeb852bc0b5cc3f15539a Mon Sep 17 00:00:00 2001 From: Nathan Totten Date: Tue, 1 Oct 2024 18:03:01 -0400 Subject: [PATCH] updated policy --- modules/blocked.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/blocked.ts b/modules/blocked.ts index 32ae451..e388d06 100644 --- a/modules/blocked.ts +++ b/modules/blocked.ts @@ -4,14 +4,19 @@ import { getBinFromUrl } from "./utils"; const BLOCKED_BINS = ["d99caaa8ed794063a917411904c65e87"]; export default async function (request: ZuploRequest, context: ZuploContext) { - const url = new URL(request.url); - const urlInfo = getBinFromUrl(url); - if (!urlInfo) { - return HttpProblems.badRequest(request, context, { - detail: "No binId specified in request", - }); + let binId: string | undefined; + if (request.params.binId) { + binId = request.params.binId; + } else { + const url = new URL(request.url); + const urlInfo = getBinFromUrl(url); + if (!urlInfo) { + return HttpProblems.badRequest(request, context, { + detail: "No binId specified in request", + }); + } + binId = urlInfo.binId; } - const { binId } = urlInfo; if (BLOCKED_BINS.includes(binId)) { return HttpProblems.forbidden(request, context, {