1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #12046: Fix URL parsing for git data sources

This commit is contained in:
jeremystretch
2023-03-30 09:07:56 -04:00
parent f965608791
commit 06dec6a2d9

View File

@ -91,10 +91,9 @@ class GitBackend(DataBackend):
username = self.params.get('username')
password = self.params.get('password')
if username and password:
url_components = list(urlparse(self.url))
# Prepend username & password to netloc
url_components[1] = quote(f'{username}@{password}:') + url_components[1]
url = urlunparse(url_components)
# Add username & password to URL
parsed = urlparse(self.url)
url = f'{parsed.scheme}://{quote(username)}:{quote(password)}@{parsed.netloc}{parsed.path}'
else:
url = self.url