Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/app/components/ResumeForm/Form/InputGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,27 @@ const getHTMLFromBulletListStrings = (bulletListStrings: string[]) => {
return "<div></div>";
}

return bulletListStrings.map((text) => `<div>${text}</div>`).join("");
return bulletListStrings
.map((text) => `<div>${escapeHtml(text)}</div>`)
.join("");
};

const escapeHtml = (value: string) =>
value.replace(/[&<>"]/g, (char) => {
switch (char) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case '"':
return "&quot;";
default:
return char;
}
});

/**
* BulletListTextareaFallback is a fallback for BulletListTextareaGeneral to work around
* content editable div issue in some browsers. For example, in Firefox, if user enters
Expand Down
2 changes: 1 addition & 1 deletion src/app/lib/parse-resume-from-pdf/read-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const readPdf = async (fileUrl: string): Promise<TextItems> => {
// since non system font name by default is a loaded name, e.g. "g_d8_f1"
// Reference: https://github.com/mozilla/pdf.js/pull/15659
const fontObj = commonObjs.get(pdfFontName);
const fontName = fontObj.name;
const fontName = fontObj?.name ?? pdfFontName ?? "Unknown";

// pdfjs reads a "-" as "-­‐" in the resume example. This is to revert it.
// Note "-­‐" is "-&#x00AD;‐" with a soft hyphen in between. It is not the same as "--"
Expand Down