inveniosoftware / invenio-files-rest

REST API for uploading/downloading files for Invenio.
https://invenio-files-rest.readthedocs.io
MIT License
9 stars 68 forks source link

views: enable views to delete files completely #146

Open nharraud opened 7 years ago

nharraud commented 7 years ago

Problem: Views don't enable to remove files from disk. As soon as a file is written it is marked as non writable. Thus remove_file_data is not be able to remove them. This task is used in views.py but will not have any effect.

lnielsen commented 7 years ago

I don't think I would change remove_file_data. It's there as a protection mechanism, so it shouldn't try to remove a file if it is not writable. I would rather say that the view/API should handle the situation?

nharraud commented 7 years ago

@lnielsen Ok. I changed the issue's title. What about adding a force optional argument to remove_file_data which would ignore the writable status. The views would then set it to True whenever an ObjectVersion is deleted and there is a need for garbage collection. Changing the writable flag would allow other file modifications, which is not what we want.