Skip to content

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

Open
@munderseth

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions