Getting Rails' ActiveStorage blob IDs from file URLs
12 hours ago
- Extract blob ID from expiring ActiveStorage URLs to avoid re-downloading images.
- The expiring URL contains a base64-encoded JSON object with a consistent blob ID.
- Method: split URL path by '/', take the third segment from the end, split by '--', decode base64, and read '_rails.data' from the JSON.
- Blob IDs are unique and not reused, allowing reliable file identification.