mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): only sanitize task id with removeSpecialChars (#60482)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
parent
6fc8c87422
commit
999b3e8928
@ -7,9 +7,9 @@ dashedName: step-67
|
||||
|
||||
# --description--
|
||||
|
||||
Finally, it is time to call the `removeSpecialChars` on the `id`, `title`, and `description` properties in your `taskObj`.
|
||||
Finally, it is time to call the `removeSpecialChars` on the `id` property in your `taskObj`.
|
||||
|
||||
This will remove issues with broken task data.
|
||||
This will help prevent issues caused by special characters in HTML element IDs.
|
||||
|
||||
With that you have completed the project.
|
||||
|
||||
@ -21,18 +21,6 @@ You should call `removeSpecialChars` on `titleInput.value` when assigning the `i
|
||||
assert.match(code, /\s*id:\s*`\$\{removeSpecialChars\(titleInput\.value\)\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\}-\$\{Date\.now\(\s*\)\}`\s*/)
|
||||
```
|
||||
|
||||
You should call `removeSpecialChars` on `titleInput.value` when assigning the `title`.
|
||||
|
||||
```js
|
||||
assert.match(code, /\s*title:\s*removeSpecialChars\(titleInput\.value\)\s*/,)
|
||||
```
|
||||
|
||||
You should call `removeSpecialChars` on `descriptionInput.value` when assigning the `description`.
|
||||
|
||||
```js
|
||||
assert.match(code, /\s*description:\s*removeSpecialChars\(descriptionInput\.value\)\s*/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
@ -698,9 +686,9 @@ const addOrUpdateTask = () => {
|
||||
const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id);
|
||||
const taskObj = {
|
||||
id: `${removeSpecialChars(titleInput.value).toLowerCase().split(" ").join("-")}-${Date.now()}`,
|
||||
title:removeSpecialChars(titleInput.value) ,
|
||||
title: titleInput.value,
|
||||
date: dateInput.value,
|
||||
description: removeSpecialChars(descriptionInput.value),
|
||||
description: descriptionInput.value,
|
||||
};
|
||||
|
||||
if (dataArrIndex === -1) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user