-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
db_url does not handle '#' in password? #55
Labels
bug
Something isn't working
Comments
Some characters must be encoded to avoid beaking the url parsing. |
Fixed with #69 |
This is still issue in 0.4.5 import os
import environ
os.environ['a'] = 'mysql://engineuser:i!kkGhs#[email protected]:3306/mydb'
env.db('a')
url ParseResult(scheme='mysql', netloc='engineuser:i!)(iLisk', path='', params='', query='', fragment='[email protected]:3306/myoperator_test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/app/python/micro_api/user-availability-api/venv/lib/python3.6/site-packages/environ/environ.py", line 204, in db_url
return self.db_url_config(self.get_value(var, default=default), engine=engine)
File "/var/app/python/micro_api/user-availability-api/venv/lib/python3.6/site-packages/environ/environ.py", line 403, in db_url_config
'PORT': _cast_int(url.port) or '',
File "/usr/lib/python3.6/urllib/parse.py", line 169, in port
port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'i!kkGhs' |
jtriley
added a commit
to nerc-project/coldfront-nerc
that referenced
this issue
Nov 1, 2021
This is needed to handle passwords with characters that are not URL-safe due to the fact that django-environ parses the DB string using urlparse. Without this we'd have to urlencode the password. See joke2k/django-environ#55
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to configure a database password that happens to contain a
#
. Is that character not supported in this package's processing of the database url? When I alter thetest_postgres_parsing
in test.py so that the password contains that character, egwegauwhgeuioweg
-->weg#auwhgeuioweg
, the test encounters this error:I've found that other special chars, such as these:
}{)(}|!\^><;
can be embedded in the database password and not break the test. For example, when I alter the password fromwegauwhgeuioweg
to:wegauw}{)(}|!\^><;hgeuioweg
on lines 238 and 245 of the test case in test.py, no tests fail.My environment is python 2.7.10.
Summary: Is it true that a
#
included in the db password will corrupt the db url?The text was updated successfully, but these errors were encountered: