Skip to content

Commit

Permalink
make sure it won't fail on missing payload
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelecerati committed Apr 14, 2024
1 parent b6108ee commit 1290e54
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/api/src/controllers/access-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ async function fireGateWebhook(
);
}
if ("pull" in content && content.pull) {
let referer: string, origin: string;
if (payload?.webhookPayload?.headers) {
referer = payload?.webhookPayload?.headers["Referer"];
origin = payload?.webhookPayload?.headers["Origin"];
}
console.log(
`access-control: gate: webhook=${
webhook.id
Expand All @@ -125,9 +130,7 @@ async function fireGateWebhook(
process.hrtime(startTime)[1] / 1e6
}ms accessKey=${payload.accessKey} playbackId=${
content.playbackId
} webhook=${webhook.id} referer=${
payload.webhookPayload.headers["Referer"]
} origin=${payload.webhookPayload.headers["Origin"]}`
} webhook=${webhook.id} referer=${referer} origin=${origin}`
);
} else {
console.log(
Expand Down

0 comments on commit 1290e54

Please sign in to comment.