mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
unescape quotes when necessary to compatible with old filter patterns
This commit is contained in:
parent
b444155a27
commit
ced088c4fa
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user