Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle dots and slashes in query #17

Merged
merged 1 commit into from Aug 28, 2021

Conversation

stardust66
Copy link

Fixes #16.

Changes:

  • Manually escape dots in query text so searching ".." doesn't lead to an error.
  • Change url parameter for the query route to a path parameter, so that it accepts slashes. Searching "date/time/event" no longer leads to error.

Before, looking up "." would lead to a reload, since the dot is interpreted as a relative path to the current directory. Now, it correctly takes you to the definition of depybu'i. In addition, looking up queries with slashes no longer lead to errors, since slashes are quoted by urllib.quote_plus.

Tests are not passing but I think they have to do with database changes. For example,

======================================================================
FAIL: Doctest: vlasisku.database.Root.query
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/doctest.py", line 2224, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for vlasisku.database.Root.query
  File "/srv/lojban/vlasisku/vlasisku/database.py", line 241, in query

----------------------------------------------------------------------
File "/srv/lojban/vlasisku/vlasisku/database.py", line 245, in vlasisku.database.Root.query
Failed example:
    len(database.root.query('class:UI4')['matches'])
Expected:
    6
Got:
    8

Changes:
- Manually escape dots in query text so searching ".." doesn't lead to
an error.
- Change variable part in query route to a path variable, so that it
accepts slashes. Searching "date/time/event" no longer leads to error.
@rlpowell rlpowell merged commit 58a76ea into lojban:master Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search queries are not sanitized
2 participants