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