Skip to content
Permalink
Browse files
[git-webkit] Cannot create pull request branch using bug URL, fails t…
…o fetch comments from Bugzilla, fails to modify bug

https://bugs.webkit.org/show_bug.cgi?id=239741

Patch by Michael Catanzaro <mcatanzaro@gnome.org> on 2022-04-26
Reviewed by Jonathan Bedard.

* Tools/Scripts/libraries/webkitbugspy/setup.py:
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py:
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py:
(Tracker.credentials.validater):
(Tracker._login_arguments):
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/bugzilla.py:
(Bugzilla.__init__):
(Bugzilla.request):

Canonical link: https://commits.webkit.org/250028@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mcatanzaro authored and webkit-commit-queue committed Apr 27, 2022
1 parent 446f86f commit b2a78a3c5258302b4e6e4e978e5b38e940f0587d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
@@ -1,3 +1,21 @@
2022-04-26 Michael Catanzaro <mcatanzaro@redhat.com>

[git-webkit] Cannot create pull request branch using bug URL, fails to fetch comments from Bugzilla, fails to modify bug
https://bugs.webkit.org/show_bug.cgi?id=239741

Reviewed by Jonathan Bedard.

Need to URL encode the username and password before appending them to the URL.

* Scripts/libraries/webkitbugspy/setup.py:
* Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py:
* Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py:
(Tracker.credentials.validater):
(Tracker._login_arguments):
* Scripts/libraries/webkitbugspy/webkitbugspy/mocks/bugzilla.py:
(Bugzilla.__init__):
(Bugzilla.request):

2022-04-26 Michael Catanzaro <mcatanzaro@redhat.com>

Cannot run test-webkitpy, autoinstaller fails to compile lupa
@@ -30,7 +30,7 @@ def readme():

setup(
name='webkitbugspy',
version='0.5.2',
version='0.5.3',
description='Library containing a shared API for various bug trackers.',
long_description=readme(),
classifiers=[
@@ -46,7 +46,7 @@ def _maybe_add_library_path(path):
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(0, 5, 2)
version = Version(0, 5, 3)

from .user import User
from .issue import Issue
@@ -112,7 +112,8 @@ def from_string(self, string):

def credentials(self, required=True, validate=False):
def validater(username, password):
response = requests.get('{}/rest/user/{}?login={}&password={}'.format(self.url, username, username, password))
quoted_username = requests.utils.quote(username)
response = requests.get('{}/rest/user/{}?login={}&password={}'.format(self.url, quoted_username, quoted_username, requests.utils.quote(password)))
if response.status_code == 200:
return True
sys.stderr.write('Login to {} for {} failed\n'.format(self.url, username))
@@ -130,8 +131,8 @@ def _login_arguments(self, required=False, query=None):
if not username or not password:
return '?{}'.format(query) if query else ''
return '?login={username}&password={password}{query}'.format(
username=username,
password=password,
username=requests.utils.quote(username),
password=requests.utils.quote(password),
query='&{}'.format(query) if query else '',
)

@@ -22,7 +22,9 @@

import json
import re
import sys
import time
import urllib

from .base import Base

@@ -54,7 +56,7 @@ def __init__(self, hostname='bugs.example.com', users=None, issues=None, environ

prefix = self.hosts[0].replace('.', '_').upper()
self._environment = environment or mocks.Environment(**{
'{}_USERNAME'.format(prefix): 'usernmae',
'{}_USERNAME'.format(prefix): 'username',
'{}_PASSWORD'.format(prefix): 'password',
})

@@ -321,7 +323,10 @@ def request(self, method, url, data=None, params=None, auth=None, json=None, **k
if not url.startswith('http://') and not url.startswith('https://'):
return mocks.Response.create404(url)

stripped_url = url.split('://')[-1]
if sys.version_info >= (3, 0):
stripped_url = urllib.parse.unquote(url).split('://')[-1]
else:
stripped_url = urllib.unquote(url).split('://')[-1]

match = re.match(r'{}/rest/user\?(?P<credentials>login=\S+\&password=\S+\&)?names=(?P<username>\S+)$'.format(self.hosts[0]), stripped_url)
if match and method == 'GET':

0 comments on commit b2a78a3

Please sign in to comment.