Skip to content

Commit

Permalink
unescape quotes when necessary to compatible with old filter patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Yang committed Jan 3, 2018
1 parent b444155 commit ced088c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/plugins/aws/package/compile/events/cloudWatchLog/index.js
Expand Up @@ -78,6 +78,13 @@ class AwsCompileCloudWatchLogEvents {
.getLambdaCloudWatchLogPermissionLogicalId(functionName,
cloudWatchLogNumberInFunction);

// unescape quotes once when the first quote is detected escaped
const idxFirstSlash = FilterPattern.indexOf('\\');
const idxFirstQuote = FilterPattern.indexOf('"');
if (idxFirstSlash >= 0 && idxFirstQuote >= 0 && idxFirstQuote > idxFirstSlash) {
FilterPattern = FilterPattern.replace(/\\("|\\|')/g, (match, g) => g);
}

const cloudWatchLogRuleTemplate = `
{
"Type": "AWS::Logs::SubscriptionFilter",
Expand Down

0 comments on commit ced088c

Please sign in to comment.