keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.62k stars 2.21k forks source link

fix file deletion #4949

Open myadzel opened 5 years ago

myadzel commented 5 years ago

Fixes issue #4946.

laurenskling commented 5 years ago

Could you please guide us through your changes?

myadzel commented 5 years ago

I just corrected the behavior of the script according to the code that someone had written earlier.

  1. The storage.removeFile interface assumes the presence of the callback function, it is added. But the deletion method passes an empty function so as not to change the logic of storage.removeFile.

  2. The value of the value variable in the updateItem method is always an empty string at deletion.

  3. Method utils.defer(callback) is called later (by code) in case of deleting a file, so it is redundant and causes an error.

  4. Also added is the deletion of the file before uploading a new one (implementation of the file replacement, which also did not work before).