]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Escape reserved characters in URIs
authorZack Cerza <zack@cerza.org>
Thu, 3 Oct 2013 16:44:47 +0000 (11:44 -0500)
committerZack Cerza <zack@cerza.org>
Thu, 3 Oct 2013 21:08:12 +0000 (16:08 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/report.py

index b8fd8909396fa91326f197edd8ad165044e77a67..de0ff43c0abe6bda622445eb4b2207d7101e5035 100755 (executable)
@@ -5,6 +5,7 @@ import yaml
 import json
 import re
 import httplib2
+import urllib
 import logging
 import argparse
 from textwrap import dedent
@@ -138,6 +139,9 @@ class ResultsReporter(object):
         successful and the reason was *not* that the object already exists,
         raise a RequestFailedError.
         """
+        # Use urllib.quote() to escape things like spaces. Pass safe=':/' to
+        # avoid it mangling http:// etc.
+        uri = urllib.quote(uri, safe=':/')
         response, content = self.http.request(
             uri, method, json_, headers={'content-type': 'application/json'},
         )