Change the name of the JSON file that is uploaded#227
Conversation
Pull Request Test Coverage Report for Build 3676696620Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
| const link = document.createElement('a'); | ||
| link.href = jsonString; | ||
| link.download = 'form_configuration.json'; | ||
| link.download = MainTitle + '.json'; |
There was a problem hiding this comment.
Maintitle is a free user input. Is it safe to directly use it as a filename ?
There was a problem hiding this comment.
What do you mean by free user input ?
There was a problem hiding this comment.
Users can enter anything they want, and we don't sanitize the content.
There was a problem hiding this comment.
It can effectively be an issue. However, I found that using the title of the form for the json file is quite the most natural. Could we fix some rules when entering the title ?
There was a problem hiding this comment.
I have some ideas in mind, but what would you suggest ?
There was a problem hiding this comment.
following up on what I mentioned this morning, something like that would do the trick: replace(/[^a-zA-Z0-9]+/g, "-")
| const link = document.createElement('a'); | ||
| link.href = jsonString; | ||
| link.download = 'form_configuration.json'; | ||
| const regexPattern = /[^a-zA-Z0-9]/g; |
There was a problem hiding this comment.
you can define it outside the function
|
SonarCloud Quality Gate failed. |









No description provided.