From d5e20f8fe8d4a91d33dfc4a450743a07c49b0f65 Mon Sep 17 00:00:00 2001 From: Aziz <119948730+aziz-access@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:40:01 +0100 Subject: [PATCH] fix(geo): garantine no comma in the beginning and end of search term (#1608) --- packages/geo/src/lib/search/shared/sources/cadastre.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/geo/src/lib/search/shared/sources/cadastre.ts b/packages/geo/src/lib/search/shared/sources/cadastre.ts index e7ab4ea973..c3cca7068d 100644 --- a/packages/geo/src/lib/search/shared/sources/cadastre.ts +++ b/packages/geo/src/lib/search/shared/sources/cadastre.ts @@ -65,9 +65,10 @@ export class CadastreSearchSource extends SearchSource implements TextSearch { term: string | undefined, options?: TextSearchOptions ): Observable[]> { + term = term.replace(/ /g, ''); + term = term.replace(/,+/g, ','); term = term.endsWith(',') ? term.slice(0, -1) : term; term = term.startsWith(',') ? term.substr(1) : term; - term = term.replace(/ /g, ''); const params = this.computeSearchRequestParams(term, options || {}); if (!params.get('numero') || !params.get('numero').match(/^[0-9,]+$/g)) {