@gallop.software/studio 2.3.26 → 2.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -386,6 +386,20 @@ async function deleteThumbnailsFromCdn(imageKey) {
386
386
  }
387
387
  }
388
388
  }
389
+ async function deleteOriginalFromCdn(imageKey) {
390
+ const bucketName = process.env.CLOUDFLARE_R2_BUCKET_NAME;
391
+ if (!bucketName) throw new Error("R2 bucket not configured");
392
+ const r2 = getR2Client();
393
+ try {
394
+ await r2.send(
395
+ new DeleteObjectCommand({
396
+ Bucket: bucketName,
397
+ Key: imageKey.replace(/^\//, "")
398
+ })
399
+ );
400
+ } catch {
401
+ }
402
+ }
389
403
 
390
404
  // src/handlers/utils/response.ts
391
405
  function jsonResponse(data, init) {
@@ -1914,7 +1928,9 @@ async function handleReprocessStream(request) {
1914
1928
  const updatedEntry = await processImage(buffer, imageKey);
1915
1929
  if (isInOurR2) {
1916
1930
  updatedEntry.c = existingCdnIndex;
1931
+ await deleteOriginalFromCdn(imageKey);
1917
1932
  await deleteThumbnailsFromCdn(imageKey);
1933
+ await uploadOriginalToCdn(imageKey);
1918
1934
  await uploadToCdn(imageKey);
1919
1935
  await deleteLocalThumbnails(imageKey);
1920
1936
  try {