From 575e81019aeee093caeac37e3d5f3c1669a60002 Mon Sep 17 00:00:00 2001 From: DrMint Date: Mon, 28 Mar 2022 13:17:30 +0200 Subject: [PATCH] Fixed bug with the sluggify --- src/queries/helpers.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/queries/helpers.ts b/src/queries/helpers.ts index c784164..9b8ce48 100644 --- a/src/queries/helpers.ts +++ b/src/queries/helpers.ts @@ -280,19 +280,19 @@ export function slugify(string: string | undefined): string { return ""; } return string - .replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/u, "a") - .replace(/[çÇ]/u, "c") - .replace(/[ðÐ]/u, "d") - .replace(/[ÈÉÊËéèêë]/u, "e") - .replace(/[ÏïÎîÍíÌì]/u, "i") - .replace(/[Ññ]/u, "n") - .replace(/[øØœŒÕõÔôÓóÒò]/u, "o") - .replace(/[ÜüÛûÚúÙù]/u, "u") - .replace(/[ŸÿÝý]/u, "y") - .replace(/[^a-z0-9- ]/iu, "") + .replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/g, "a") + .replace(/[çÇ]/gu, "c") + .replace(/[ðÐ]/gu, "d") + .replace(/[ÈÉÊËéèêë]/gu, "e") + .replace(/[ÏïÎîÍíÌì]/gu, "i") + .replace(/[Ññ]/gu, "n") + .replace(/[øØœŒÕõÔôÓóÒò]/gu, "o") + .replace(/[ÜüÛûÚúÙù]/gu, "u") + .replace(/[ŸÿÝý]/gu, "y") + .toLowerCase() + .replace(/[^a-z0-9- ]/gu, "") .trim() - .replace(/ /iu, "-") - .toLowerCase(); + .replace(/ /gu, "-"); } export function randomInt(min: number, max: number) {