eny.space Landingpage
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(dashboard): improve hostname normalization and disk size validation

+15 -2
+15 -2
app/api/webhooks/route.ts
··· 18 18 .slice(0, 63); 19 19 } 20 20 21 + function normalizeDeployHostname(raw: string) { 22 + let h = raw.trim(); 23 + h = h.replace(/^https?:\/\//i, ""); 24 + h = h.replace(/\/.*$/, ""); 25 + return h.replace(/\/$/, ""); 26 + } 27 + 21 28 async function provisionPdsForUser({ 22 29 userId, 23 30 userEmail, ··· 37 44 } 38 45 39 46 const password = randomBytes(16).toString("base64url"); 40 - const hostname = pdsHostnameBase.trim(); 47 + const hostname = normalizeDeployHostname(pdsHostnameBase); 41 48 42 - const disksize = Number(disksizeGb); 49 + const disksizeParsed = Number(disksizeGb); 50 + if (!Number.isFinite(disksizeParsed) || disksizeParsed <= 0) { 51 + throw new Error( 52 + `Invalid pds_disksize_gb metadata value: "${disksizeGb}". Expected a positive number.`, 53 + ); 54 + } 55 + const disksize = Math.floor(disksizeParsed); 43 56 44 57 const supabase = createAdminClient(); 45 58