fix(frontend): remove double encoding of series name in URL (#262)

Angular Router already encodes path segments automatically. Manually
calling encodeURIComponent() before router.navigate() caused double
encoding (%25 in URL), which was rejected by Spring Security's
StrictHttpFirewall on page refresh (F5), resulting in a Whitelabel
Error Page.

Remove encodeURIComponent() from 3 navigation call sites and the
corresponding decodeURIComponent() workaround in series-page component.

Co-authored-by: de.banker <hub9ray@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
graypawn
2026-04-22 17:26:55 -04:00
committed by Zach Yale
co-authored by de.banker Claude Opus 4.6
parent c1711dd0c1
commit a92459ddbf
4 changed files with 3 additions and 6 deletions
@@ -666,8 +666,7 @@ export class BookCardComponent implements OnInit, OnChanges {
openSeriesInfo(): void {
const seriesName = this.book?.metadata?.seriesName;
if (this.isSeriesCollapsed && seriesName) {
const encodedSeriesName = encodeURIComponent(seriesName);
this.router.navigate(['/series', encodedSeriesName]);
this.router.navigate(['/series', seriesName]);
} else {
this.openBookInfo(this.book);
}
@@ -142,7 +142,6 @@ export class SeriesPageComponent implements AfterViewChecked {
private seriesParam = toSignal(this.route.paramMap.pipe(
map((params) => params.get("seriesName") || ""),
map((name) => decodeURIComponent(name))
), {initialValue: ""});
filteredBooks = computed(() => {
@@ -805,8 +805,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
}
goToSeries(seriesName: string): void {
const encodedSeriesName = encodeURIComponent(seriesName);
this.router.navigate(['/series', encodedSeriesName]);
this.router.navigate(['/series', seriesName]);
}
goToPublisher(publisher: string): void {
@@ -156,7 +156,7 @@ export class UrlHelperService {
filterBooksBy(filterKey: string, filterValue: string) {
if (filterKey === 'series') {
return this.router.createUrlTree(['/series', encodeURIComponent(filterValue)])
return this.router.createUrlTree(['/series', filterValue])
}
return this.router.createUrlTree(['/all-books'], {