fix(ui): encode filter values in query params to handle commas in names (#2117) (#2717)

This commit is contained in:
ACX
2026-02-12 09:21:23 -07:00
committed by GitHub
parent ae041f900f
commit 414b6d8d9e
5 changed files with 6 additions and 5 deletions
@@ -26,6 +26,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.nio.charset.Charset;
@@ -249,7 +249,7 @@ export class BookBrowserQueryParamsService {
serializeFilters(filters: Record<string, string[]>): string {
return Object.entries(filters)
.map(([k, v]) => `${k}:${v.join('|')}`)
.map(([k, v]) => `${k}:${v.map(val => encodeURIComponent(val)).join('|')}`)
.join(',');
}
@@ -262,7 +262,7 @@ export class BookBrowserQueryParamsService {
const [key, ...valueParts] = pair.split(':');
const value = valueParts.join(':');
if (key && value) {
parsedFilters[key] = value.split('|').map(v => v.trim()).filter(Boolean);
parsedFilters[key] = value.split('|').map(v => decodeURIComponent(v.trim())).filter(Boolean);
}
});
@@ -246,7 +246,7 @@ export class SeriesPageComponent implements OnDestroy {
sort: "title",
direction: "asc",
sidebar: true,
filter: `${filterKey}:${filterValue}`,
filter: `${filterKey}:${encodeURIComponent(filterValue)}`,
},
});
}
@@ -848,7 +848,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
sort: 'title',
direction: 'asc',
sidebar: true,
filter: `${filterKey}:${filterValue}`
filter: `${filterKey}:${encodeURIComponent(filterValue)}`
}
});
}
@@ -604,7 +604,7 @@ export class MetadataManagerComponent implements OnInit, OnDestroy {
sort: 'title',
direction: 'asc',
sidebar: true,
filter: `${filterKey}:${filterValue}`
filter: `${filterKey}:${encodeURIComponent(filterValue)}`
}
});
}