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
Form File Input (b-form-file) does not work correctly when directories are dropped onto it #4912
Closed
shaljam opened this issue
Mar 9, 2020
· 1 comment
· Fixed by #4913, Asthriona/Ashtriona-Blog#10, CodeForBaltimore/codeforbaltimore.org#23, tghelere/CL#22 or mariazevedo88/hash-generator-js#41
Closed
Form File Input (b-form-file) does not work correctly when directories are dropped onto it #4912
shaljam opened this issue
Mar 9, 2020
· 1 comment
· Fixed by #4913, Asthriona/Ashtriona-Blog#10, CodeForBaltimore/codeforbaltimore.org#23, tghelere/CL#22 or mariazevedo88/hash-generator-js#41
Labels
Comments
When directories are dropped (on browsers that support directory mode), the result can be a nested array (of only a directory is dropped). If you select a file plus a directory and drag those, you will see an array passed with two entries, one being the file, and the other entry an array containing the directory's files. |
jacobmllr95
added a commit
that referenced
this issue
Mar 9, 2020
…fixes #4912) (#4913) * fix(b-form-file): fix value prop validation when using directory mode Fixes #4912 * Update form-file.js * Update form-file.js * Update form-file.js * Update form-file.js * Update form-file.js * Update form-file.js * Update form-file.js Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Validation fails when a dropped you drop a directory onto
BFormFile
. The model seems not processed and contains nested arrays as apposed to selecting the same directory. When using the open dialog, this works fine and the model is anArray
ofFile
s.This makes the validation fail as we can see this in the validator:
bootstrap-vue/src/components/form-file/form-file.js
Line 46 in d567ceb
Steps to reproduce the bug
b-form-file
settingmultiple
anddirectory
b-form-file
b-form-file
fails:b-form-file
not setting thefile-name-formatter
result.Expected behavior
Model value should be set correctly, validation should not fail, and the result of
file-name-formatter
should be set.Versions
Libraries:
Environment:
Demo link
https://jsfiddle.net/k42983pd/
Additional context
I was going to use
Array.prototype.flat()
to flatten the model array. But I noticed the component is in a bad state when validation fails. I also found that the presence ofmultiple
does not affect this problem.The text was updated successfully, but these errors were encountered: