Skip to content

Commit 0cb03cb

Browse files
authored
decode HTML entities in Polymer jobs (#1830)
* decode HTML entities in Polymer jobs * <, right...
1 parent 83b5f9e commit 0cb03cb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/helpers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,11 @@ export const normalizeGitHubCommitUrl = url => {
187187
.replace('/repos', '')
188188
.replace('commits', 'commit')
189189
}
190+
191+
export const decodeHtmlEntities = str =>
192+
str
193+
?.replace(/&lt;/g, '<')
194+
.replace(/&gt;/g, '>')
195+
.replace(/&quot;/g, '"')
196+
.replace(/&#39;/g, "'")
197+
.replace(/&amp;/g, '&')

pages/jobs/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Icon from '../../components/icon'
99
import Image from 'next/image'
1010
import zephyrPic from '../../public/jobs/zephyr-group-pic.jpg'
1111
import { compact } from 'lodash'
12+
import { decodeHtmlEntities } from '../../lib/helpers'
1213

1314
const JobListing = ({
1415
positionName,
@@ -156,7 +157,7 @@ const Page = ({ jobs }) => (
156157
jobs.items.map(job => (
157158
<JobListing
158159
key={job.id}
159-
positionName={job.title}
160+
positionName={decodeHtmlEntities(job.title)}
160161
positionDesc={job.job_category_name}
161162
positionLink={job.job_post_url}
162163
positionLocation={job.display_location}

0 commit comments

Comments
 (0)