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:
Roberto Iacono 2025-05-25 19:58:18 +02:00 committed by GitHub
parent 6fc8c87422
commit 999b3e8928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {