Title: [293495] trunk/Tools
Revision
293495
Author
[email protected]
Date
2022-04-26 19:48:40 -0700 (Tue, 26 Apr 2022)

Log Message

[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

Patch by Michael Catanzaro <[email protected]> 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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (293494 => 293495)


--- trunk/Tools/ChangeLog	2022-04-27 02:31:23 UTC (rev 293494)
+++ trunk/Tools/ChangeLog	2022-04-27 02:48:40 UTC (rev 293495)
@@ -1,5 +1,23 @@
 2022-04-26  Michael Catanzaro  <[email protected]>
 
+        [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  <[email protected]>
+
         Cannot run test-webkitpy, autoinstaller fails to compile lupa
         https://bugs.webkit.org/show_bug.cgi?id=239786
 

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/setup.py (293494 => 293495)


--- trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-04-27 02:31:23 UTC (rev 293494)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-04-27 02:48:40 UTC (rev 293495)
@@ -30,7 +30,7 @@
 
 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=[

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py (293494 => 293495)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-04-27 02:31:23 UTC (rev 293494)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-04-27 02:48:40 UTC (rev 293495)
@@ -46,7 +46,7 @@
         "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

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py (293494 => 293495)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py	2022-04-27 02:31:23 UTC (rev 293494)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py	2022-04-27 02:48:40 UTC (rev 293495)
@@ -112,7 +112,8 @@
 
     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 @@
         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 '',
         )
 

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/bugzilla.py (293494 => 293495)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/bugzilla.py	2022-04-27 02:31:23 UTC (rev 293494)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/bugzilla.py	2022-04-27 02:48:40 UTC (rev 293495)
@@ -22,7 +22,9 @@
 
 import json
 import re
+import sys
 import time
+import urllib
 
 from .base import Base
 
@@ -54,7 +56,7 @@
 
         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 @@
         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':
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to