Attach s3 url to active storage without re-upload the file

Hi,

I need to migrate from refile to activestorage. We already have files on s3, but when attaching to activestorage, it will re-upload our files again. It’s ok for the first step, but we also has a react app that will upload file to s3 directly, then when submitting to the rails api, we only have s3 url.

I read the document, but there is no guide to do this one. I guess from the s3 url, we will get all the info that activestorage needs and then create a record manually? Is there any way that activestorage already supported?

There’s no guide available and no automated process. You can do it manually, but that will only work if all your files are in the root of the bucket. Is that the case? (I’ve never used refile, so I don’t how how it stores files in S3)

I see, then I will need read the file from s3 url and then create a check sum data and collect all other info of the file and then store to the database. I wish active storage will support this soon, because when using SPA, we will upload directly to s3 without sending request to our api, our api only receives the s3 url to store in the database