Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You should be more restrictive here - don't allow any unsafe-file-name characters, #7

Open
munderseth opened this issue Apr 10, 2023 · 0 comments

Comments

@munderseth
Copy link
Contributor

munderseth commented Apr 10, 2023

          You should be more restrictive here - don't allow any unsafe-file-name characters, 
const unsafeRegex = /[^A-Za-z0-9_]/g;

Best would be to find Cypress's pattern (from their source) and copy it here.

Originally posted by @ivailop in #6 (comment)


I briefly checked Cypress's code and couldn't find where they construct/cleanup the files name. However, based on existing conventions:

Following that the code should be:

const unsafeRegex = /[^A-Za-z0-9._-\w]/g;
var imageBasename = testFullName.replaceAll(unsafeRegex, '').substring(0, 242)+' (failed).png';

Originally posted by @ivailop #6 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant