Refactor R2 key prefix for deterministic identifiers

This commit is contained in:
thePR0M3TH3AN committed 2026-01-26 12:47:05 -05:00
1 parent 00b0e85438
commit c02db755ac
6 files changed
+42 -12

No files matched your search

+6 -1
View File
@@ -215,6 +215,11 @@ class S3UploadService {
try {
await ensureS3SdkLoaded();
const normalizedInfoHash = normalizeInfoHash(infoHash);
const keyIdentifier = isValidInfoHash(normalizedInfoHash)
? normalizedInfoHash
: "";
const s3 = makeS3Client({
endpoint: normalized.endpoint,
region: normalized.region,
@@ -223,7 +228,7 @@ class S3UploadService {
forcePathStyle: Boolean(normalized.forcePathStyle),
});
const key = forcedVideoKey || buildR2Key(npub, file);
const key = forcedVideoKey || buildR2Key(npub, file, keyIdentifier);
const publicUrl =
forcedVideoUrl ||
buildS3ObjectUrl({