Skip to content

Commit

Permalink
fix: Directly use regex to avoid string parsing problems
Browse files Browse the repository at this point in the history
  • Loading branch information
aswanson-nr committed Jan 11, 2024
1 parent 7680202 commit 5f596ca
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions utils/lib/Alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ import { CUSTOM_EVENT, recordNerdGraphResponse } from '../newrelic/customEvent';
// within a nrql query. This portion is to help validate against
// very specific edge cases to ensure we don't have anything break
// during an install once it hits our UIs.
const TIMESERIES = '\sTIMESERIES\s';
const INVALID_QUERY_KEYWORDS = [TIMESERIES] as const;

// RegExp matches the _first_ instance of any invalid keywords
const INVALID_REGEX = new RegExp(INVALID_QUERY_KEYWORDS.join('|'), 'mi');
const INVALID_REGEX = /\sTIMESERIES[\s]?/mi

interface RequiredDataSources {
id: string;
Expand Down

0 comments on commit 5f596ca

Please sign in to comment.