Skip to content

Commit

Permalink
fix(oas3): escape regular expression before using it (#9691)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n committed Mar 13, 2024
1 parent b5ce300 commit b1d7e4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/plugins/oas3/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @prettier
*/
import { OrderedMap, Map, List } from "immutable"
import escapeRegExp from "lodash/escapeRegExp"
import constant from "lodash/constant"

import { getDefaultRequestBodyValue } from "./components/request-body"
Expand Down Expand Up @@ -248,7 +249,7 @@ export const serverEffectiveValue = onlyOAS3((state, locationData) => {
let str = serverValue

varValues.map((val, key) => {
str = str.replace(new RegExp(`{${key}}`, "g"), val)
str = str.replace(new RegExp(`{${escapeRegExp(key)}}`, "g"), val)
})

return str
Expand Down

0 comments on commit b1d7e4b

Please sign in to comment.