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

Search URL settings are not used #1598

Open
HyperCriSiS opened this issue May 22, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@HyperCriSiS
Copy link

commented May 22, 2019

Hi,

I configured Searx tested the generated preferences URL several times now also with different browser, but it is always the same, the settings are not used.
That's the URL:

https://***/searx/?preferences=eJx1VMmO2zAM_Zr6YrTocujJh6JF0QEKzKAz7VVgJNohLIseUU7ivy-VcWy5yyGOTVGP73GLKJNPYjiYgGeT4NB8BS9YOSYTUdifMDYM-vmGY1d5CN0EHTYOK88W_PXNkcDBozOjnzoK0vyi4bWnHs2RU4-zvHr_-RF9a-5Cy3GARByy7X7EkKMoBeMp9CuPQ-SzYMx8Vr9P1qKI-XJ_p1fOkRJWNCgVM0a-zAttmBJbHkaPSZlNts-_jiuBFgUh2mPztkpHHLBhsRArDHvm356eHh5vATS0Mqagr0ZsZO_V8hTB9srt54_v6jewJugqL4Nn_hYSdhxnI-jRpi05GDQCStOT7UGVmJY8ZnltRKyF23SGiLWjqNcygKGkpyeGZIywJfD1gI5AjRTAmBM55AwQ0Tn626lj7jzWo4e5hnEsIlprX6dTgdBRpyRBFKTDgBF8AasVyT4gvSTEoXRpXWRyG3CYQYld65I_V6lboILTMAlZY65_ejRDcHgp0TvEPtGAsqTiBf3m76g7pP9B84mwjPvuUtASRDei1nDF2ix_JXW91UJkXrPh6RAhznVmKyQl7dwJdMJ6bz1QOmgzYlrEzHDMcEUuo44AgS1CvkjaOb2Q2AyY5oGDTs_OLXE_c2I5cg9hk3kEJZ0fu4SuktsIA2RhuJwP86AdripThCBeO9uVUejyPGmFSxPrqEYcuWi25zOEXV9tc1m_KP1nafYtdfv6Q9hKfWmGm9A_3G635UwiVndLGdFCiLWkONk0xUxGLGGweGWTa2nZYZ0fS1YKlE3Uuw8fPl52E5U8HJYbC7sbjXUsrnTXHXRbELfO-1fGSqskiGnMK7B0dV3t8Lq08pbdtYpuVdoKWA2Yjuyah_vHp2rZWjo0zXL8Gw8DTj0=&q=

What could be the issue?

Thanks,
Hyper

@rachmadaniHaryono

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

hi, i just tried your issue on python3.6

here is the traceback

Traceback (most recent call last):
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/app.py", line 1811, in full_dispatch_request
    rv = self.preprocess_request()
  File "/home/q/envs/searx/lib/python3.6/site-packages/flask/app.py", line 2087, in preprocess_request
    rv = func()
  File "/home/q/git/searx/searx/webapp.py", line 422, in pre_request
    preferences.parse_encoded_data(request.form['preferences'])
  File "/home/q/git/searx/searx/preferences.py", line 295, in parse_encoded_data
    self.parse_dict({x: y[0] for x, y in parse_qs(unicode(decoded_data)).items()})
  File "/home/q/git/searx/searx/preferences.py", line 300, in parse_dict
    self.key_value_settings[user_setting_name].parse(user_setting)
  File "/home/q/git/searx/searx/preferences.py", line 94, in parse
    self._validate_selections(elements)
  File "/home/q/git/searx/searx/preferences.py", line 81, in _validate_selections
    raise ValidationException('Invalid value: "{0}"'.format(selections))
searx.preferences.ValidationException: Invalid value: "["general'"]"

it seem there is error on quote character there

@rachmadaniHaryono

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

this is an error from str typecase

original

>>> url_params = 'e...='
>>> from zlib import compress, decompress
>>> decoded_data = decompress(urlsafe_b64decode(url_params.encode('utf-8')))
>>> dict_data = {x: y[0] for x, y in parse_qs(unicode(decoded_data)).items()}
>>> dict_data['categories']
"general'"

compare to this

>>> dict_data = {x: y[0] for x, y in parse_qs(unicode(decoded_data)).items()}
>>> dict_data['categories']
>>> dict_data = {}
>>> for x, y in parse_qs(decoded_data).items():
>>>     dict_data[x.decode('utf8')] = y[0].decode('utf8')
>>> dict_data['categories']
'general'

will make pr for this later

@rachmadaniHaryono rachmadaniHaryono referenced a pull request that will close this issue May 22, 2019

Open

Feature/fix encode decode #1599

@rachmadaniHaryono

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

hi @HyperCriSiS i made pr for this. can you check if this work for you?

@HyperCriSiS

This comment has been minimized.

Copy link
Author

commented May 23, 2019

I installed it with Yunohost. How can I update it?

Thanks!!

@rachmadaniHaryono

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

i'm not familiar with yunohost, but if you install searx from source you can check out the pr as described here https://help.github.com/en/articles/checking-out-pull-requests-locally

another alternative is to wait till other can test and the pr merged and wait till another release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.