From 4fc0cdf4a35674e4ee37711f66c01f67b2f7a18d Mon Sep 17 00:00:00 2001 From: Stephen Yeargin Date: Thu, 4 Apr 2024 08:47:59 -0500 Subject: [PATCH] Tighten up regex --- src/scripts/pagerduty.js | 2 +- test/pager-me-test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/pagerduty.js b/src/scripts/pagerduty.js index dcc83fb..2852a31 100644 --- a/src/scripts/pagerduty.js +++ b/src/scripts/pagerduty.js @@ -92,7 +92,7 @@ module.exports = function (robot) { msg.send("Okay, I've forgotten your PagerDuty email"); }); - robot.respond(/(pager|major)( me)? incident (.*)$/i, function (msg) { + robot.respond(/(pager|major)( me)? incident ([a-z0-9]+)$/i, function (msg) { msg.finish(); if (pagerduty.missingEnvironmentForApi(msg)) { diff --git a/test/pager-me-test.js b/test/pager-me-test.js index bb77052..5812039 100644 --- a/test/pager-me-test.js +++ b/test/pager-me-test.js @@ -35,7 +35,7 @@ describe('pagerduty', function () { }); it('registers a pager incident listener', function () { - expect(this.robot.respond).to.have.been.calledWith(/(pager|major)( me)? incident (.*)$/i); + expect(this.robot.respond).to.have.been.calledWith(/(pager|major)( me)? incident ([a-z0-9]+)$/i); }); it('registers a pager sup listener', function () {