fix: history component crashing on special characters (fixes #2743)

This commit is contained in:
Andrew Bastin
2022-10-07 23:00:32 +05:30
parent f759014315
commit 528d0b0429

View File

@@ -56,7 +56,7 @@
/>
</summary>
<component
:is="page == 'rest' ? HistoryRestCard : HistoryGraphqlCard"
:is="page === 'rest' ? HistoryRestCard : HistoryGraphqlCard"
v-for="(entry, index) in filteredHistoryGroup"
:id="index"
:key="`entry-${index}`"
@@ -122,7 +122,7 @@ import {
isEqualHoppRESTRequest,
safelyExtractRESTRequest,
} from "@hoppscotch/data"
import { groupBy } from "lodash-es"
import { groupBy, escapeRegExp } from "lodash-es"
import { useTimeAgo } from "@vueuse/core"
import { pipe } from "fp-ts/function"
import * as A from "fp-ts/Array"
@@ -213,7 +213,10 @@ const filteredHistory = computed(() =>
return (
!!input.updatedOn &&
(filterText.value.length === 0 ||
deepCheckForRegex(input, new RegExp(filterText.value, "gi")))
deepCheckForRegex(
input,
new RegExp(escapeRegExp(filterText.value), "gi")
))
)
}
),