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:
@@ -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('/'))
|
||||
|
||||
Reference in New Issue
Block a user