fix(pl24): drop P4 nav-crumb links from decoded categories
VIN-group HTML for Ford/Volvo legacy services exposes the header breadcrumb links (Portal / Model seçimi / current VIN) via the same .action pattern the parser relied on, so they were being persisted as "part categories" — users saw three useless rows instead of real groups. The PSA flow already documented this trap and bypassed rawData; extend the same defense to the rest of P4 legacy (parser-side + categories insert fallback). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,8 +148,13 @@ export class CategoriesService {
|
||||
|
||||
if (decodedCats && decodedCats.length > 0) {
|
||||
try {
|
||||
// Strip P4 header/breadcrumb nav crumbs (Portal, "Model seçimi",
|
||||
// current VIN) — these slipped past the older decoder filter and
|
||||
// sit in cached rawData; they are never real part categories.
|
||||
const NAV_CRUMB_RE = /(portal|vehicle|vin-group|logout)\.action/i;
|
||||
const seenNames = new Set<string>();
|
||||
const uniqueCats = decodedCats.filter((c) => {
|
||||
if (c.linkPath && NAV_CRUMB_RE.test(c.linkPath)) return false;
|
||||
const name = c.nameTr || c.nameEn;
|
||||
if (seenNames.has(name)) return false;
|
||||
seenNames.add(name);
|
||||
|
||||
@@ -3752,6 +3752,18 @@ export class PL24FordLegacyService {
|
||||
// Filter to only category-like links (exclude navigation/auth links)
|
||||
const filtered = categoryLinks.filter((link) => {
|
||||
const href = link.href.toLowerCase();
|
||||
// Header/breadcrumb nav crumbs on the VIN page (Portal, "Model seçimi",
|
||||
// current VIN). They match action-link patterns but are never real
|
||||
// categories — exclude before any include-rule can pick them up.
|
||||
if (
|
||||
href.includes("portal.action") ||
|
||||
href.includes("vehicle.action") ||
|
||||
href.includes("vin-group.action") ||
|
||||
href.includes("logout.action") ||
|
||||
href.includes("login")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
// Include group/category navigation links
|
||||
if (
|
||||
href.includes("group") ||
|
||||
@@ -3761,13 +3773,8 @@ export class PL24FordLegacyService {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
// Exclude login, keep-alive, etc.
|
||||
if (
|
||||
href.includes("login") ||
|
||||
href.includes("keep-alive") ||
|
||||
href.includes("logout") ||
|
||||
href.includes("json-")
|
||||
) {
|
||||
// Exclude keep-alive, json- helper endpoints.
|
||||
if (href.includes("keep-alive") || href.includes("json-")) {
|
||||
return false;
|
||||
}
|
||||
// Include if it looks like a content link with text
|
||||
|
||||
Reference in New Issue
Block a user