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

[Bug Report] VFileInput multiple="false" changes the value for rules #9530

Closed
Aukemid opened this issue Oct 31, 2019 · 1 comment
Closed
Assignees
Labels
C: VFileInput T: bug Functionality that does not work as intended/expected
Milestone

Comments

@Aukemid
Copy link

Aukemid commented Oct 31, 2019

Environment

Vuetify Version: 2.1.7
Vue Version: 2.6.10
Browsers: Chrome 78.0.3904.70
OS: Mac OS 10.15.1

Steps to reproduce

See codepen in the reproduction link.

  1. Add a file in the first file input and the value parameter in the rules function is a File object. See console.
  2. Add a file in the second file input and the File object is wrapped in an array. This should be the same as in step 1.

Expected Behavior

The value parameter of the rules functions should be a File object if you don't set the multiple property or set multiple to false.

Actual Behavior

If you don't set the multiple property, the value in the rules function is a File object as it should be. If you set multiple to false the value is an array which contains the File object.

Reproduction Link

https://codepen.io/Aukemid/pen/BaawqEM

Other comments

I believe this is caused by VFileInput.isMultiple which only checks whether the multiple property exists. The following change works in my test cases.

isMultiple() {
  // return this.$attrs.hasOwnProperty('multiple');
  return this.$attrs.hasOwnProperty('multiple') && this.$attrs.multiple !== false;
},
@ghost ghost added the S: triage label Oct 31, 2019
nkoik pushed a commit to nkoik/vuetify that referenced this issue Nov 1, 2019
@jacekkarczmarczyk jacekkarczmarczyk added T: bug Functionality that does not work as intended/expected C: VFileInput and removed S: triage labels Nov 9, 2019
nkoik pushed a commit to nkoik/vuetify that referenced this issue Nov 11, 2019
nkoik pushed a commit to nkoik/vuetify that referenced this issue Nov 11, 2019
@jacekkarczmarczyk jacekkarczmarczyk added the S: has PR The issue has a pending Pull Request label Nov 15, 2019
@jacekkarczmarczyk jacekkarczmarczyk removed the S: has PR The issue has a pending Pull Request label Jan 11, 2020
@all43
Copy link

all43 commented Nov 4, 2020

Still relevant for 2.3.16.
If we have <v-file input :multiple="false" /> it won't allow you select multiple files (as $attrs passed directly to the input), but still wraps value in array, as property only checked for existence not truthiness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VFileInput T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants