1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 21:26:44 +02:00

sanitizing query

This commit is contained in:
Igor Chubin
2018-07-14 08:22:58 +00:00
parent 91176634bc
commit 6e190adbcf
+5
View File
@@ -265,6 +265,9 @@ def _visualize(query, keyword, answers, request_options, html=None): # pylint: d
return result, found
def _sanitize_query(query):
return re.sub('[<>"]', '', query)
def cheat_wrapper(query, request_options=None, html=False):
"""
Giant megafunction that delivers cheat sheet for `query`.
@@ -297,6 +300,8 @@ def cheat_wrapper(query, request_options=None, html=False):
return topic, keyword, search_options
query = _sanitize_query(query)
# at the moment, we just remove trailing slashes
# so queries python/ and python are equal
query = _strip_hyperlink(query.rstrip('/'))