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

Missing validation message for userform upload field #177

Open
maxime-rainville opened this issue Jul 1, 2020 · 9 comments
Open

Missing validation message for userform upload field #177

maxime-rainville opened this issue Jul 1, 2020 · 9 comments

Comments

@maxime-rainville
Copy link

Validation message on the userform upload fields do not show up on the front end.

Error when using the simple theme

image

Exact same form and error using Watea/Starter

image

@emteknetnz
Copy link
Member

@emteknetnz
Copy link
Member

Possibly related silverstripe/silverstripe-userforms#991

@emteknetnz emteknetnz assigned emteknetnz and unassigned emteknetnz Jul 26, 2020
@emteknetnz
Copy link
Member

@maxime-rainville

I tried to replicate this on kitchen-sink 4.x-dev

I'm not able to select an svg, it seems a though my browser (firefox, chrome) blocks me from even selecting certains file types based on the 'accept' attribute. They are greyed on in the osx file manager that I use to select a file to upload. This is the same on watea, starter and simple

image

If I manually remove the accept attribute I can submit anything to the server, the page reloads, and file extensions that are not allowed caused the form the re-render with no error message. No form submission is created in the backend either

It seems as though the 'accept' attribute is doing enough to stop invalid files from being uploaded, so we don't really need to worry about error messages not being shown?

@maxime-rainville
Copy link
Author

It's not blocking me on Ubuntu with Firefox ... how dare you suggest that linux users on Firefox are a tiny portions of our user base! These are the most discerning of our users.

If it's going to be a mission to solve this, than it might not be worth fixing. But since the message is showing up correctly in simple, my assumption was that it would be an easy fix.

@emteknetnz
Copy link
Member

emteknetnz commented Jul 28, 2020

Maybe this PR Garion did will fix it on your local for starter and watea

silverstripe/silverstripe-userforms#992

Try updating silverstripe-userforms to the latest 5.6.x-dev

@emteknetnz
Copy link
Member

emteknetnz commented Aug 2, 2020

@maxime-rainville have you had a chance to retest this one with Garion's patch applied?

@maxime-rainville
Copy link
Author

Just tried running silverstripe/silverstripe-userforms#992 locally and it didn't seem to fix it.

I also tried running on Edge in my Windows VM and managed to upload a bad file, so I don't think it's a Ubuntu only issue.

The file I use to test was an SVG file with a different extension. The Mime validator will pick up that extension mismatched and fail the form.

@emteknetnz
Copy link
Member

OK, so you are saying you need to update a file with the wrong extension to get this issue to show?

If that's the case, I don't think it's worth fixing this since this is only a UX issue, not a security issue

Can you replicate this issue using a normal file?

@maxime-rainville
Copy link
Author

It's any validation message that associated to the file upload field. If you upload a file that's too big, you'll probably get the same problem.

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