Skip to content

Change the name of the JSON file that is uploaded#227

Merged
Ghita2002 merged 5 commits intomainfrom
d_voting_Ghita
Dec 12, 2022
Merged

Change the name of the JSON file that is uploaded#227
Ghita2002 merged 5 commits intomainfrom
d_voting_Ghita

Conversation

@Ghita2002
Copy link
Contributor

No description provided.

@Ghita2002 Ghita2002 requested a review from nkcr November 28, 2022 19:52
@Ghita2002 Ghita2002 requested a review from a team as a code owner November 28, 2022 19:52
@Ghita2002 Ghita2002 self-assigned this Nov 28, 2022
@coveralls
Copy link

coveralls commented Nov 28, 2022

Pull Request Test Coverage Report for Build 3676696620

Warning: 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

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 56.825%

Totals Coverage Status
Change from base Build 3567462676: 0.0%
Covered Lines: 3272
Relevant Lines: 5758

💛 - Coveralls

const link = document.createElement('a');
link.href = jsonString;
link.download = 'form_configuration.json';
link.download = MainTitle + '.json';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintitle is a free user input. Is it safe to directly use it as a filename ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by free user input ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can enter anything they want, and we don't sanitize the content.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some ideas in mind, but what would you suggest ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can define it outside the function

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell C 5 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Ghita2002 Ghita2002 merged commit 0336d26 into main Dec 12, 2022
@Ghita2002 Ghita2002 deleted the d_voting_Ghita branch December 12, 2022 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants