From 87f1dd0fce17ba7c0ba3f0589b96e477ab397bfe Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Thu, 4 Jun 2026 00:24:01 +0330 Subject: [PATCH] =?UTF-8?q?fix(admin):=20slugify=20without=20/u=20flag=20(?= =?UTF-8?q?ES5=20target)=20=E2=80=94=20keep=20Persian/Arabic=20via=20liter?= =?UTF-8?q?al=20ranges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- src/components/admin/AdminResource.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/admin/AdminResource.tsx b/src/components/admin/AdminResource.tsx index dda4c08..1bfbf4a 100644 --- a/src/components/admin/AdminResource.tsx +++ b/src/components/admin/AdminResource.tsx @@ -45,13 +45,14 @@ const inputCls = "w-full rounded-lg border border-[#262b40] bg-[#0c0e1a] px-3 py const PAGE_SIZE = 25; -/** URL-safe slug; keeps unicode letters (incl. Persian) + digits, spaces → "-". */ +/** URL-safe slug; keeps Latin, digits and Persian/Arabic letters, spaces → "-". + * Uses explicit unicode ranges (no /u flag) for older TS targets. */ export function slugify(s: string): string { return s .trim() .toLowerCase() .replace(/\s+/g, "-") - .replace(/[^\p{L}\p{N}-]+/gu, "") + .replace(/[^a-z0-9؀-ۿݐ-ݿﭐ-﷿ﹰ--]+/g, "") .replace(/-+/g, "-") .replace(/^-|-$/g, ""); }