Skip to content

Commit 31c9973

Browse files
authored
fix: handle condition where bucket is the same as blurred bucket
1 parent 128cfe3 commit 31c9973

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

functions/v2/imagemagick/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ functions.cloudEvent('blurOffensiveImages', async cloudEvent => {
3434
// This event represents the triggering Cloud Storage object.
3535
const bucket = cloudEvent.data.bucket;
3636
const name = cloudEvent.data.name;
37+
38+
if (bucket === BLURRED_BUCKET_NAME) {
39+
console.log('Event triggered by the blurred bucket; skip to avoid recursion')
40+
return;
41+
}
42+
3743
const file = storage.bucket(bucket).file(name);
3844
const filePath = `gs://${bucket}/${name}`;
3945

0 commit comments

Comments
 (0)