Open History to see the last commit
1export const WITHHELD = "[withheld]";
2const WEBHOOK_URL_TOKEN =
3 /(\/(?:v1\/hooks\/[0-9a-f]{16}|api\/hooks)\/[^/\s"'\\]+\/)[A-Za-z0-9_-]+/g;
4
5/**
6 * Shows a webhook URL with its last segment withheld, as Settings is where the full URL lives.
7 * Matches the URL as the server prints it, not an escaped or split one.
8 */
9export const withoutWebhookUrlToken = (text: string) =>
10 text.replace(WEBHOOK_URL_TOKEN, `$1${WITHHELD}`);