#42 Escape package names for bugzilla query
Merged 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

file modified
+2 -2
@@ -30,6 +30,7 @@ 

  import requests

  import bugzilla

  import koji

+ import urllib.parse

  

  from bodhi.client.bindings import BodhiClient

  from urllib3.util.retry import Retry
@@ -449,9 +450,8 @@ 

      """

      data = []

      bzapi = bugzilla.Bugzilla("bugzilla.redhat.com")

- 

      query = bzapi.url_to_query("https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=__open__&"

-                                "classification=Fedora&product=Fedora&product=Fedora EPEL&component=%s" % package)

+                                "classification=Fedora&product=Fedora&product=Fedora EPEL&component=%s" % urllib.parse.quote(package))

      query["include_fields"] = ['blocks', 'comments', 'creation_time', 'creator', 'id', 'keywords', 'last_change_time',

                                 'severity', 'priority', 'status', 'summary', 'version', 'whiteboard']

      bugs = bzapi.query(query)

Fixes https://pagure.io/fedora-qa/packager_dashboard/issue/30

Pagure API accepts + signs in the API without any issues, so I am leaving that untouched.

Pull-Request has been merged by frantisekz

3 years ago
Metadata