From 578220740406a68e407502460128c6982ae5a0cd Mon Sep 17 00:00:00 2001 From: John Date: Thu, 1 Aug 2024 10:53:05 -0500 Subject: [PATCH] tsignore --- src/utils/contentApi.ts | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/utils/contentApi.ts b/src/utils/contentApi.ts index 3e2b2329..a173bab9 100644 --- a/src/utils/contentApi.ts +++ b/src/utils/contentApi.ts @@ -353,6 +353,7 @@ export default class ContentApi { // we remove any special characters from the end of the label // to make it look cleaner in the UI + // @ts-ignore label = label.replace(/[^\p{L}\p{N}]+$/u, ""); // if (!duplicator.has(label)) { @@ -380,18 +381,21 @@ export default class ContentApi { */ static slugify(url: string): string { try { - return url - .toString() - .normalize("NFD") - .replace(/[\u0300-\u036f]/g, "") - .toLowerCase() - .trim() - .replace(/\s+/g, "-") - .replace(/\./g, "") - .replace(/[^\p{L}\p{N}]+/gu, "-") - .replace(/^-/g, "") - .replace(/-$/g, "") - .replace(/--+/g, "-"); + return ( + url + .toString() + .normalize("NFD") + .replace(/[\u0300-\u036f]/g, "") + .toLowerCase() + .trim() + .replace(/\s+/g, "-") + .replace(/\./g, "") + // @ts-ignore + .replace(/[^\p{L}\p{N}]+/gu, "-") + .replace(/^-/g, "") + .replace(/-$/g, "") + .replace(/--+/g, "-") + ); } catch (err) { console.error("[slugify error]", err); return "#err";