Open hbayindir opened 1 week ago
Unfortunately there is no support in InvenioRDM for showing this kind custom upload errors in UI
What is the exact issue here? Are you running this validation asynchronously? Are you expecting to respond with an error to the upload request?
Is your feature request related to a problem? Please describe.
We have implemented a file validation procedure for uploaded files in our fork of
invenio-files-rest
package to enhance user security and improve sustainability of the uploaded data in our local instance, Aperta. In short, we make sure that the files are in the formats we like, there are no nasty surprises inside, and files are intact and openable.However, when a user encounters an error, or rejected by one of these filters, we can't notify them about what happened.
This feature is a carryover from our old Aperta installation, which was a fork of Zenodo, and we were able to show these notifications on that version.
Describe the solution you'd like
We want to be able to notify the user about problems in their file(s), and what failed. So they can fix the problem and send the correct version/alternative of the file instead.
Describe alternatives you've considered
Since there's no way to communicate these errors and float them towards the UI and the user, we were unable to find any other alternatives.
Additional context
The things we do are as follows:
tar
(tar
,tar.gz
,tar.bz2
,tar.xz
) andzip
compressed files to detect any issues during extraction.Rar
and7z
formats are not supported;rar
is a proprietary format, and reliable health checks for both formats would require third-party libraries, which we aim to avoid.If files pass all these checks, they're accepted as valid download, otherwise we reject them with an error. For a detailed explanation of what we do, please see the flowchart added below.
The file validation checks are executed once the file has fully uploaded, allowing us to perform integrity checks on compressed formats. If any validation fails, the file is immediately deleted from storage, and a
FileCheckError
—a custom exception inheriting fromStorageError
— is raised to indicate the failure.This is where the problem surfaces. Unfortunately there is no support in InvenioRDM for showing this kind custom upload errors in UI. To be able to inform the user about the problem in a detailed manner, we want these errors to be visible in the UI, and want to introduce this feature into the file uploader(s) InvenioRDM has. There're talks about a new file uploader, and if that one will be the default, we'd love to add the support for it. Otherwise we want to introduce the feature to the old one and hopefully backport it to the newer one in due course.
Any help and guidance is greatly appreciated.
Flowchart:
P.S.: You can ping me and @geekdinazor about this issue. As I aforementioned, we want to implement and contribute this, if accepted. We may need some help from you.