-
Notifications
You must be signed in to change notification settings - Fork 20
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
template-import: Add format check to the import file upload #447
base: release
Are you sure you want to change the base?
template-import: Add format check to the import file upload #447
Conversation
d8a92d4
to
befd791
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking if the filename ends with "xls" or "xlsx" isn't enough to ensure that the file is a valid Spreadsheet file. I could just upload an empty file with the name "xlsx" and it would trigger either the same or a similar exception as before. So we should either verify that it's a valid file beforehand, or somehow inform the Page that it's an invalid file.
906201a
to
d9c1eec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I now start an import to an already existing template, the template is duplicated under the same name instead of (as happened before) the file in the already existing template being swapped. Also, the same template name should be allowed only once per project.
Regarding file recognition:
- .xslt is accepted, which is ok, but not being recognized by error message (may be an undocumented feature, so all right), but
- .xslm is sometimes accepted and sometimes rejected, and I do not understand why.
- .xls is rejected when it is in fact CSV, which is ok, but possibly deserves an error of its own
- uploading real old .xls files lead a new error (Caused by: java.lang.ClassCastException: org.apache.poi.hssf.usermodel.HSSFWorkbook cannot be cast to org.apache.poi.xssf.usermodel.XSSFWorkbook), so either handle this or remove .xls support
Everything else seems to be alright.
As I accidently already tested the ticket, you might consider moving the ticket to project 2 as well.
bedef99
to
ce8e9db
Compare
This pull request adds a check before accessing the uploaded import file. This verifies that the uploaded file matches the needed file format to perform an import. This behavior is verified by an implemented test.
Closes #355