mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-26 21:41:50 +00:00
feat: disable dompurify for non string & number types
This commit is contained in:
parent
13bfa5767b
commit
2d6cda1aef
1 changed files with 3 additions and 2 deletions
|
|
@ -85,8 +85,9 @@ export const apiLogin = async (data: CandidateLogin): Promise<number> => {
|
||||||
export const apiFillDetails = async (data: CandidateData): Promise<CandidateData> => {
|
export const apiFillDetails = async (data: CandidateData): Promise<CandidateData> => {
|
||||||
// Sanitize candidate data
|
// Sanitize candidate data
|
||||||
Object.keys(data.candidate).forEach((key) => {
|
Object.keys(data.candidate).forEach((key) => {
|
||||||
// TODO: Enable DOMPurify onyl on string & number types
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
if (key === "grades") return;
|
// @ts-ignore
|
||||||
|
if (typeof data.candidate[key] !== 'string' && typeof data.candidate[key] !== 'number') return;
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
data.candidate[key] = DOMPurify.sanitize(data.candidate[key]);
|
data.candidate[key] = DOMPurify.sanitize(data.candidate[key]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue