Skip to content

Commit

Permalink
Generate complaint path URLs with clean IDs
Browse files Browse the repository at this point in the history
We have a function to strip HTML tags like <em> out of complaint IDs
before rendering them. It was erroneously being applied only to the rendered
ID numbers and not also the URLs that get generated from the ID numbers.

To see the bug in action, try clicking on the complaint that appears in
these search results:

https://www.consumerfinance.gov/data-research/consumer-complaints/search/?date_received_max=2023-10-12&date_received_min=2020-10-12&page=1&searchField=all&searchText=4340364&size=25&sort=created_date_desc&tab=List

See DATAP-1210
  • Loading branch information
contolini committed Oct 12, 2023
1 parent bb23eaa commit eaa4058
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/List/ComplaintCard/ComplaintCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import React from 'react';
const MAX_NARRATIVE = 300;

export const ComplaintCard = ({ row }) => {
const complaintIdPath = 'detail/' + row.complaint_id;
const _stripPossibleHighlight = (s) => {
const re = /(<em>)?(.*?)(<\/em>)?/gi;
return s.replace(re, '$2');
};
const cleanId = _stripPossibleHighlight(row.complaint_id);
const complaintIdPath = 'detail/' + _stripPossibleHighlight(row.complaint_id);

const _renderPossibleHighlight = (s) => {
return (
Expand Down

0 comments on commit eaa4058

Please sign in to comment.