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

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

Open
beszabo1 opened this issue Apr 10, 2024 · 0 comments
Open

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

beszabo1 opened this issue Apr 10, 2024 · 0 comments

Comments

@beszabo1
Copy link

beszabo1 commented Apr 10, 2024

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

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

No branches or pull requests

2 participants