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:
parent
1429e4e9af
commit
11b7619653
1 changed files with 2 additions and 1 deletions
|
|
@ -240,8 +240,9 @@ export class VideoService {
|
||||||
if ((await this.requireStorage().directPublicJwk()) === null) {
|
if ((await this.requireStorage().directPublicJwk()) === null) {
|
||||||
throw new ServiceUnavailableException("DIRECT_EC_PRIVATE_KEY is not configured");
|
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 uploadId = randomUUID();
|
||||||
const objectKey = directObjectKey();
|
const objectKey = `direct/${uploadId}.enc`;
|
||||||
const putUrl = await this.requireStorage()
|
const putUrl = await this.requireStorage()
|
||||||
.presignPut(objectKey, input.mimeType, DIRECT_PUT_TTL_SECONDS)
|
.presignPut(objectKey, input.mimeType, DIRECT_PUT_TTL_SECONDS)
|
||||||
.catch(() => { throw new ServiceUnavailableException("Video storage is unavailable: could not presign the direct PUT"); });
|
.catch(() => { throw new ServiceUnavailableException("Video storage is unavailable: could not presign the direct PUT"); });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue