Open simonbaird opened 3 years ago
There's method that can extract a site name from a ThFile object, which is better than nothing, but still I'd like to do this if it's possible.
I thought the rails attachment metadata would be useful here, but that is local to rails, and doesn't push any metadata up to S3. I think the s3 code supports it, but using it would take some digging into the gem internals.
Using a custom key that includes the site id is probably the way to do it. b8154dfdaa560bd8883e957e35612aad88314e8d does that for thumbnails, but was reverted since I suspected it was causing performance problems, but now I think it probably wasn't.
If we do lose some database changes (touch wood) blobs in S3 will still be there, but rails active storage won't know their keys. If we could discover the site id for a blob (or maybe user id and site name?), we would have a chance of recovering it.
I think S3 files have metadata. Can I poke some fields into it? If so then how?
Update (2024): I think I'll do it with custom blob keys. Updated the title.