import { randomUUID } from 'node:crypto' import { sanitizeFilename } from '@admin/actions/storage/sanitize-filename' /** * Object-key naming scheme for every upload, shared by all storage providers. * * Single owner: a project that switches storage providers must keep producing * consistent keys. This previously existed as an identical copy inside each of * the R2, Railway Bucket, and Vercel Blob payloads. */ export function buildStorageObjectKey(filename: string, prefix = 'uploads'): string { return `${prefix}/${Date.now()}-${randomUUID()}-${sanitizeFilename(filename)}` }