file's accepted mimetypes as "*" results in a regex error · Issue #2487 · jquery-validation/jquery-validation · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

file's accepted mimetypes as "*" results in a regex error #2487

Open
@beszabo1

Description

@beszabo1

Sorry if this is the intended behavior, but while updating this package from an old version (1.14 to 1.20) we came across this issue, so I wanted to create a note of it. Maybe it should be more of a feature request, but it is inconsistent given how the default "image/*" is handled.

Current behavior

Providing the accept as "*" resolves it as a faulty regex (since it is)

Expected behavior

Handle "*" as ".*", similar to how "/*" is handled as "/.*", or more realistically do this only when a single "*" is provided.

Live demo

....validate({
                rules: {
                    file_input: {
                        required: true,
                        extension: "gif|json",
                        accept: "*" // currently using ".*" for the code to run as expected
                    }
                },

Relevant code line

https://github.com/jquery-validation/jquery-validation/blob/master/src/additional/accept.js#L22

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.