@epic-web/workshop-app 6.20.5 → 6.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/server/index.js +17 -1
- package/build/server/index.js.map +1 -1
- package/package.json +3 -3
package/build/server/index.js
CHANGED
|
@@ -1456,7 +1456,11 @@ const ToastSchema = z.object({
|
|
|
1456
1456
|
id: z.string().default(() => createId()),
|
|
1457
1457
|
title: z.string().optional(),
|
|
1458
1458
|
type: TypeSchema.default("message")
|
|
1459
|
-
})
|
|
1459
|
+
}).transform((toast2) => ({
|
|
1460
|
+
...toast2,
|
|
1461
|
+
title: toast2.title ? sanitizeCookieValue(toast2.title) : void 0,
|
|
1462
|
+
description: sanitizeCookieValue(toast2.description)
|
|
1463
|
+
}));
|
|
1460
1464
|
const toastSessionStorage = createCookieSessionStorage({
|
|
1461
1465
|
cookie: {
|
|
1462
1466
|
name: "EpicShop_toast",
|
|
@@ -1467,6 +1471,18 @@ const toastSessionStorage = createCookieSessionStorage({
|
|
|
1467
1471
|
secure: process.env.NODE_ENV === "production"
|
|
1468
1472
|
}
|
|
1469
1473
|
});
|
|
1474
|
+
function sanitizeCookieValue(value) {
|
|
1475
|
+
return value.split("").map((char) => {
|
|
1476
|
+
const code = char.charCodeAt(0);
|
|
1477
|
+
if (code > 255) {
|
|
1478
|
+
if (code === 8216 || code === 8217) return "'";
|
|
1479
|
+
if (code === 8220 || code === 8221) return '"';
|
|
1480
|
+
if (code === 8211 || code === 8212) return "-";
|
|
1481
|
+
return "?";
|
|
1482
|
+
}
|
|
1483
|
+
return char;
|
|
1484
|
+
}).join("");
|
|
1485
|
+
}
|
|
1470
1486
|
async function redirectWithToast(url, toast2, init) {
|
|
1471
1487
|
return redirect(url, {
|
|
1472
1488
|
...init,
|