tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.39k stars 359 forks source link

Plus (+) signs in DB URL password should be preserved as is #1505

Open Rongronggg9 opened 8 months ago

Rongronggg9 commented 8 months ago

Describe the bug https://github.com/tortoise/tortoise-orm/blob/76cfc14232fcc8eba8680db4ec293952d14cb1a9/docs/databases.rst?plain=1#L27-L33 https://github.com/tortoise/tortoise-orm/blob/76cfc14232fcc8eba8680db4ec293952d14cb1a9/tortoise/backends/base/config_generator.py#L175

Escaping ` (space) with+is only allowed in query strings (that is to say,+in other parts should stay as is when decoded) and is obsolete. Popular libraries, e.g.,libpqand SQLAlchemy, require (space) to be percent-encoded (%20) and preserve+inusername:passwordas is when decoding. Some PaaS platforms, e.g., [Railway.app](https://railway.app), pass DB URL with plain+` in the password, via environment variables, etc.

To Reproduce N/A

Expected behavior Use urlparse.unquote() instead.

Additional context