trilbymedia / grav-plugin-flex-directory

Flexible plugin that allows CRUD functionality on complex data types
MIT License
39 stars 7 forks source link

File uploads incompatible with avoid_overwriting: true #12

Closed dm9876 closed 7 years ago

dm9876 commented 7 years ago

This is kind of follow on from issue 11 It is also not working properly with form setting of avoid_overwriting: true

I have that setting working fine for a frontend form where the file name gets prefixed with some other string and the original file which had the same name does not get overwritten, also output from the form references the new file name correctly.

However with flex directory, the file is overwritten and the name stays the same. Even if you assume not t support avoid_overwriting: true this breaks down since if you add a file that has the same file, OK. The big problem comes if you try to fix it and delete the file (via flex-directory) then the other directory entries that referenced the file do not have the entry removed and they point to a file that does not exist anymore. This then has flow on effects in the front end display of the directory entries as well

Hoping is can be updated to support avoid_overwriting: true

rhukster commented 7 years ago

Tested this also an it works fine for me.. First user:

2017-03-20 at 4 54 pm

Then uploading the same file for another user:

2017-03-20 at 4 55 pm

Notice the prefix has been added.

I think this might be related to the fact that I'm running with latest Grav and Admin RC versions as well as latest Form plugin release. These probably have some fixes that are ensuring stuff just works. Can you try updating?

To update to the latest RC version, set GPM Releases to Testing in the system config and check for updates.

dm9876 commented 7 years ago

Thank you. I appreciate you taking the time to check. I will either test with RC or wait next release and will re-visit the issue if not resolved.