chungchunwang / Budibase-File-Upload

Upload files in your Budibase app!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty file causes upload error on Postgres DB

VenSlazer opened this issue · comments

Hey,

I've encountered the following issue while using Budibase-File-Upload:

I have a Postgres DB setup with a particular text field for uploading invoices (Rechnung in german).
When I now want to add or update a new record, but without adding a file with Budibase-File-Upload, I receive an error 500 from the Database saying, that the type is incorrect.

That would be an example response:
{"status":500,"validationErrors":{"Rechnung":["must be of type string","has an incorrect length"]}}

Upon further investigation, I noticed, that as soon as Budibase-File-Upload is included into the Form-Element, the corresponding Field is set to an integer 0. => In my case, that means ... Rechnung: 0, ... => and that seems to be the problem, cause in the Payload, an integer is sent to the Database instead of a string.

When I leave Budibase-File-Upload out or replace it with a normal text-input filed, I can upload without a problem.

I also tried to modify the payload upon clicking the Submit-Button (if Rechnung equals to 0, replace the 0 with ""), but that doesn't work either.

The strange thing though, it has worked in the past with BudiBase versions prior to 2.5.x

Can someone help me with this?

Hi! Hopefully this should be fixed - I think the culprit is that I accidentally set the default value to be 0 instead of "" when registering the field. Try updating the plugin to see if it works now.

Hey @chungchunwang,

yes, that did the trick ;-). Thank you very much!