mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 12:18:54 -05:00
Escape user and passwords for mongo (#2111)
* Escape user and passwords for mongo. * Quote -> Quote_Plus * formatting
This commit is contained in:
parent
c1d8272b49
commit
7971c02dc5
@ -1,5 +1,6 @@
|
||||
import motor.motor_asyncio
|
||||
from .red_base import BaseDriver
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
__all__ = ["Mongo"]
|
||||
|
||||
@ -15,7 +16,9 @@ def _initialize(**kwargs):
|
||||
db_name = kwargs.get("DB_NAME", "default_db")
|
||||
|
||||
if admin_user is not None and admin_pass is not None:
|
||||
url = "mongodb://{}:{}@{}:{}/{}".format(admin_user, admin_pass, host, port, db_name)
|
||||
url = "mongodb://{}:{}@{}:{}/{}".format(
|
||||
quote_plus(admin_user), quote_plus(admin_pass), host, port, db_name
|
||||
)
|
||||
else:
|
||||
url = "mongodb://{}:{}/{}".format(host, port, db_name)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user