Rails ActionText: Disable Direct Upload
Asked Answered
L

0

7

Is there a way to disable direct upload of images and attachments from the ActionText/Trix Editor and replace it with a POST request to the rails backend to do the upload to S3?

I'm trying to do this to audit any user upload actions from Rails application standpoint.

Updates: I'm thinking I can probably extend the ActiveStorage::DirectUploadsController to do this audit. I'm still curious about the original question.

I'm also thinking about writing javascript to change data attribute (data-direct-upload-url) of <trix-editor> html form element.

Lexington answered 6/12, 2019 at 22:1 Comment(3)
I realize that I am a little late to the game, but what did you end up doing to work around this? We have our storage service on a private network which doesn't work with direct uploads.Acrostic
I think I kept the direct upload and did audit another way. You can change ActiveStorage config to point to your private network.Lexington
We're having a heck of a time figuring out the ActionText piece (drag and drop is wonderful but very much wants to direct upload - which seems to always require direct access to the storage service). The ActiveStorage proxy config helped a lot with the downloads but uploads via ActionText/Trix always reference the public (and thus not accessible) Azure storage endpoint.Acrostic

© 2022 - 2024 — McMap. All rights reserved.