fix: video direct init binds the object key to the upload id

init minted two random uuids (uploadId + objectKey), so /complete's
direct/<uploadId>.enc binding check could never pass.
This commit is contained in:
glass beadian 2026-10-16 11:06:09 +00:00
parent 1429e4e9af
commit 11b7619653

View file

@ -240,8 +240,9 @@ export class VideoService {
if ((await this.requireStorage().directPublicJwk()) === null) {
throw new ServiceUnavailableException("DIRECT_EC_PRIVATE_KEY is not configured");
}
// ONE uuid: the object key binds to the upload id so /complete can pin it.
const uploadId = randomUUID();
const objectKey = directObjectKey();
const objectKey = `direct/${uploadId}.enc`;
const putUrl = await this.requireStorage()
.presignPut(objectKey, input.mimeType, DIRECT_PUT_TTL_SECONDS)
.catch(() => { throw new ServiceUnavailableException("Video storage is unavailable: could not presign the direct PUT"); });