Skip to content

Commit 5bd2d69

Browse files
committed
Fix profitwell account limit workaround
Some long emails don't quite fit, so let's ensure this never notably increases the domain length
1 parent 0b6ab8e commit 5bd2d69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/src/accounting.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export async function recordSubscription(
134134
body.includes("Subscription limit of 8 reached for this user. Cannot create more.")
135135
) {
136136
return recordSubscription(
137-
email + `.extra-${new Date().getFullYear().toString().slice(2)}`, // .extra-24 (36 char limit on emails!)
137+
email.replace(/\.([^.@])+$/, `.${new Date().getFullYear().toString().slice(2)}`),
138+
// replace (for example) .com with .24 (36 char limit on emails!)
138139
subscription,
139140
traits,
140141
retries

0 commit comments

Comments
 (0)