Skip to content

Commit b1d7e4b

Browse files
authored
fix(oas3): escape regular expression before using it (#9691)
1 parent b5ce300 commit b1d7e4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/plugins/oas3/selectors.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @prettier
33
*/
44
import { OrderedMap, Map, List } from "immutable"
5+
import escapeRegExp from "lodash/escapeRegExp"
56
import constant from "lodash/constant"
67

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

250251
varValues.map((val, key) => {
251-
str = str.replace(new RegExp(`{${key}}`, "g"), val)
252+
str = str.replace(new RegExp(`{${escapeRegExp(key)}}`, "g"), val)
252253
})
253254

254255
return str

0 commit comments

Comments
 (0)