nazirov91 / ra-strapi-rest

React Admin data provider for Strapi.js
125 stars 40 forks source link

ImageInput causes CastError: Cast to ObjectId failed for value "[]" at path "avatar" #33

Closed wvanooijen92 closed 1 year ago

wvanooijen92 commented 3 years ago

This issue was already created, but I didn't get response so I created this new thread.

https://github.com/nazirov91/ra-strapi-rest/issues/24

Please see my response

@nazirov91 I am running into this problem as well, it goes away when I change this to

        if(existingFileIds.length === 1){
            data[fieldName] = existingFileIds[0]; 
        }else if (existingFileIds.length > 1) {
            data[fieldName] = [...existingFileIds];
        }

I am not sure that this will play nice in all scenarios tho, maybe you have more insight on this.

nazirov91 commented 1 year ago

Hi!

Please see the readme file. I have updated the package to make it work with Strapi V4. Please open a new issue if the problem persists.

Thanks!