Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export: fix the url generation #613

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}`;
}
});
}
}
Expand Down