jungsoft/uploadex

Improve error message for extension validation

Closed this issue · 1 comments

Files.wrap_files now returns a tuple containing {file, field, opts}, and this is passed directly into the error message in the Validation module, resulting in something like:

"Some files in [{\"personal_document.jpg\", :personal_document, {Uploadex.S3Storage, [bucket: \"bucket\", region: \"us-east-1\", directory: \"/customer/2\"]}}] violate the accepted extensions: [\".pdf\"]"

Instead, we should only use the first value of the tuple, to show something like:

"Some files in [\"personal_document.jpg\"] violate the accepted extensions: [\".pdf\"]"

Also, should it validate all files or only files being changed?

I think it makes sense to only validate files that are being changed. Could be any drawbacks when doing this?