Skip to content

Commit

Permalink
fix(#1277): compare string without dangerous regex injection for slas…
Browse files Browse the repository at this point in the history
…h cmd (#1287)

* fix(slash-regexes): fixes #1277

* fix(slash-regexes): switch re-find for str/includes?

* fix(slash-regexes): rm try/catch

* fix(slash-regexes): rm unneeded #

* style/lint

Co-authored-by: jeff <tangj1122@gmail.com>
  • Loading branch information
arthurbarroso and tangjeff0 committed Jun 7, 2021
1 parent 10c1d3a commit c1c4c2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cljs/athens/views/blocks/textarea_keydown.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[athens.util :refer [scroll-if-needed get-day get-caret-position shortcut-key? escape-str]]
[cljsjs.react]
[cljsjs.react.dom]
[clojure.string :refer [replace-first blank?]]
[clojure.string :refer [replace-first blank? includes? lower-case]]
[goog.dom :refer [getElement]]
[goog.dom.selection :refer [setStart setEnd getText setCursorPosition getEndPoints]]
[goog.events.KeyCodes :refer [isCharacterKey]]
Expand Down Expand Up @@ -114,7 +114,7 @@
(if (blank? query)
slash-options
(filterv (fn [[text]]
(re-find (re-pattern (str "(?i)" query)) text))
(includes? (lower-case text) (lower-case query)))
slash-options)))


Expand Down

0 comments on commit c1c4c2a

Please sign in to comment.