Skip to content

Commit

Permalink
updated policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ntotten committed Oct 1, 2024
1 parent 1c8c42b commit 99b1def
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions modules/blocked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 99b1def

Please sign in to comment.