-
Notifications
You must be signed in to change notification settings - Fork 754
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
fileUpload: Unable to upload a file without extension #4863
Comments
@cnsgithub can you assist? |
Indeed, no extension should be allowed. After having a look to |
One of my users reported this issue recently. It seems there not much I can do in my application, since some users don't even understand about file extensions and that sometimes their files don't have one. I didn't find a way to better handle the exception, it would be nice if it could at least return a validation message. I thought about trying to write a PR, but I as it was already mentioned, the extension is used in other methods of FileUploadUtils and it might cause some side effects. |
I think we should throw an exception. i know its used in a few place but if a file name is not valid we should let end users know. |
I think you got this the wrong way. There is absolutely no reason to not accept a filename without an extension for upload. It is perfectly valid, and especially common on Unix systems (README, Makefile etc.). So I think an throwing an exception is the completely wrong solution here. |
@stolp +1 |
@stolp there are two different issues here.
I think both issues need to be fixed. |
Sorry as these 2 issues are related: #4843 |
@melloware I agree, the way exceptions are thrown and handled here is broken. Sorry for misunderstanding you here. But in case of the issue here, the FacesExceptions thrown in getValidFilename should be omitted (as in the case of the empty extension) or at least be catched properly elsewhere in the component code (for the other cases present there). |
Yep I am going to attempt to fix both issues. |
1) Environment
2) Expected behavior
It should be possible to upload any existing file.
3) Actual behavior
Files without extensions cause a FacesExeption.
4) Steps to reproduce
Create a file named 'foobar' and try to upload it
Reason for this is the following code in FileUploadUtils.getValidFilename:
This seems to enforce the presence of a filename extension for later checks. I am unsure if this is really needed.
The most pressing problems are:
The text was updated successfully, but these errors were encountered: