You should be more restrictive here - don't allow any unsafe-file-name characters, #7
Open
Description
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:
- should contain only portable characters - see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
- including "spaces" as they appear to be preserved
- should not be longer then
255
(including extension) characters - see https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations
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)
Metadata
Assignees
Labels
No labels