From 35d24a1c4cf1ca1bf11a907d3b2fc034d52a2d2c Mon Sep 17 00:00:00 2001 From: Jeremy Cohen Hoffing Date: Thu, 10 Mar 2022 16:04:10 -0800 Subject: [PATCH] fix comparison logic for prefix/suffix --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3e78d78..374f3c7 100644 --- a/index.js +++ b/index.js @@ -327,18 +327,18 @@ function findFilterMatches ({ filters, record }) { } const prefixFilter = filters.filter(([key]) => key == 'prefix'); - const suffixFilter = filters.filter(([key]) => key == 'suffix'); - if (prefixFilter.length > 1) { throw 'More than one prefix is not allowed.'; } + const suffixFilter = filters.filter(([key]) => key == 'suffix'); if (suffixFilter.length > 1) { throw 'More than one suffix is not allowed.'; } let prefix = prefixFilter.length < 1 || prefixFilter[0][1] === record.s3.object.key.split('/')[0]; let suffix = suffixFilter.length < 1 || suffixFilter[0][1] === record.s3.object.key.split('.').pop(); - return prefix || suffix; + + return prefix && suffix; } function opts (pragma) {