Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: a way to void local file storage for file fields #554

Open
hughbris opened this issue Feb 13, 2022 · 3 comments
Open

Feature request: a way to void local file storage for file fields #554

hughbris opened this issue Feb 13, 2022 · 3 comments

Comments

@hughbris
Copy link
Contributor

I have custom form actions defined by a plugin that upload files to cloud storage locations. I would like to explicitly not store them locally because they are sensitive (I use write-only credentials to upload them).

I looked through $form->uploadFiles() and it looks to error out when destination is not set (around line 604).

I would find it useful to be able to suppress form upload with something like destination: false. I couldn't see an obvious elegant patch for this, unfortunately.

I don't know if the use case(s) justify this, but thought I'd ask. I could probably create a custom form action to clean up the uploaded files to work around this limitation.

@hughbris
Copy link
Contributor Author

I had the bright idea to create a destination directory that is a symlink to /dev/null. Could have been a great hack. What happened was that an exception was thrown at line 1025 in copyFiles() (PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_MOVE).

That would have followed failing the is_dir() test on line 1023. Seems that is_dir does follow symlinks, but /dev/null is not a directory.

I've tried to think of constructive suggestions to work around this:

  • add a test: is_link AND readlink is '/dev/null' (a bit case-specific and also Unix-specific)
  • add an event onCopyFormUploads or something, trigger it, and bind copyFiles to it in the plugin. This would allow plugins to override it.
  • support destination: false as mentioned originally.

This is tricky. In the meantime, I might have to run a cleanup script on cron.

@hughbris
Copy link
Contributor Author

Just stumbled on this, note to self to try it: #287 (comment)

@mahagr
Copy link
Member

mahagr commented May 16, 2022

We are already implementing this and it will be a free plugin.

I'm not sure if the first version will allow private files in S3, but it already stores those with random uuids so they are impossible to locate unless you know the name. But it shouldn't be too hard to implement ACL-protected files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants