Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update format-commission-description-tooltip.ts

Steven Teyb1c10b8974a7
diff --git a/apps/web/lib/commissions/format-commission-description-tooltip.ts b/apps/web/lib/commissions/format-commission-description-tooltip.ts
index 380c706ed2..0ec0486d91 100644
--- a/apps/web/lib/commissions/format-commission-description-tooltip.ts
+++ b/apps/web/lib/commissions/format-commission-description-tooltip.ts
@@ -1,7 +1,8 @@
import { CLAWBACK_REASONS_MAP } from "@/lib/zod/schemas/commissions";
import { APP_DOMAIN, PARTNERS_DOMAIN } from "@dub/utils";
-const PAYOUT_ID_REGEX = /po_[^\s]+/g;
+// Canonical payout IDs: `po_` + 25-char base32 ULID body.
+const PAYOUT_ID_REGEX = /po_[0-9A-HJKMNP-TV-Z]{25}/g;
export type CommissionDescriptionTooltipContext =
| { variant: "program"; workspaceSlug: string }
@@ -18,10 +19,11 @@ export function formatCommissionDescriptionTooltip(
const text = getCommissionDescriptionText(description);
return text.replace(PAYOUT_ID_REGEX, (payoutId) => {
+ const encodedPayoutId = encodeURIComponent(payoutId);
const href =
context.variant === "program"
- ? `${APP_DOMAIN}/${context.workspaceSlug}/program/payouts/${payoutId}`
- : `${PARTNERS_DOMAIN}/payouts?payoutId=${payoutId}`;
+ ? `${APP_DOMAIN}/${context.workspaceSlug}/program/payouts/${encodedPayoutId}`
+ : `${PARTNERS_DOMAIN}/payouts?payoutId=${encodedPayoutId}`;
return `[${payoutId}](${href})`;
});