diff options
| author | rr- | 2016-09-29 22:45:40 +0200 |
|---|---|---|
| committer | rr- | 2016-09-29 22:47:41 +0200 |
| commit | 977cc47966f4b9dfddf62e53d9c614593fd29f7f (patch) | |
| tree | 3eb3c683754082d8b6cc292cedfb6f92138d6b6d /client/js/util | |
| parent | 7648f479a9660794700a51dc9f9ca51264a1dd71 (diff) | |
client/search: escape : in tag search
Diffstat (limited to 'client/js/util')
| -rw-r--r-- | client/js/util/misc.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/client/js/util/misc.js b/client/js/util/misc.js index 3258030..56eb66e 100644 --- a/client/js/util/misc.js +++ b/client/js/util/misc.js @@ -213,6 +213,10 @@ function arraysDiffer(source1, source2, orderImportant) { source2.filter(value => !source1.includes(value)).length > 0); } +function escapeSearchTerm(text) { + return text.replace(/([a-z_-]):/g, '$1\\:'); +} + module.exports = { range: range, formatUrlParameters: formatUrlParameters, @@ -231,4 +235,5 @@ module.exports = { splitByWhitespace: splitByWhitespace, arraysDiffer: arraysDiffer, decamelize: decamelize, + escapeSearchTerm: escapeSearchTerm, }; |