From 08013ef355608ce169c391e2f3524556d1848d5d Mon Sep 17 00:00:00 2001 From: Joe Moon <34864012+M-Moon@users.noreply.github.com> Date: Tue, 11 Apr 2023 09:32:49 +0100 Subject: [PATCH] fix wrong urllib parse function being used to percent encode usernames and passwords, where before spaces would be incorrectly encoded to '+' instead of '%20' which is behaviour for a different usecase --- doc/examples/authentication.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/examples/authentication.rst b/doc/examples/authentication.rst index a984d17fc0..43fc73e2a1 100644 --- a/doc/examples/authentication.rst +++ b/doc/examples/authentication.rst @@ -15,10 +15,10 @@ Username and password must be percent-escaped with >>> from pymongo import MongoClient >>> import urllib.parse - >>> username = urllib.parse.quote_plus('user') + >>> username = urllib.parse.quote('user') >>> username 'user' - >>> password = urllib.parse.quote_plus('pass/word') + >>> password = urllib.parse.quote('pass/word') >>> password 'pass%2Fword' >>> MongoClient('mongodb://%s:%s@127.0.0.1' % (username, password))