From 1ad1ff011d88939db062d37b983c663ec79aea2d Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Mon, 29 Apr 2024 12:04:39 +0200 Subject: [PATCH] export: fix the url generation * Closes rero/rero-ils#3265. Co-Authored-by: Bertrand Zuchuat --- .../src/lib/record/search/record-search.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/rero/ng-core/src/lib/record/search/record-search.component.ts b/projects/rero/ng-core/src/lib/record/search/record-search.component.ts index 4a5560a8..f1a23539 100644 --- a/projects/rero/ng-core/src/lib/record/search/record-search.component.ts +++ b/projects/rero/ng-core/src/lib/record/search/record-search.component.ts @@ -597,6 +597,7 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy { * @return formatted url for an export format. */ getExportFormatUrl(format: any) { + const queryParams = Object.keys(this.activatedRoute.snapshot.queryParams); // TODO: maybe we can use URLSerializer to build query string const baseUrl = format.endpoint ? format.endpoint @@ -613,7 +614,11 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy { // force value to an array const values = (!Array.isArray(value)) ? [value] : value; values.map(v => { - url += `&${key}=${v}`; + // We check whether the parameter exists in the current url. + // If it does, we don't add the preFilter parameter. + if (!queryParams.includes(key)) { + url += `&${key}=${v}`; + } }); } }