From ff120d7fb559d4b5e3f23159af113ddc837b8918 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 3 Oct 2013 11:44:47 -0500 Subject: [PATCH] Escape reserved characters in URIs Signed-off-by: Zack Cerza --- teuthology/report.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/teuthology/report.py b/teuthology/report.py index b8fd8909396fa..de0ff43c0abe6 100755 --- a/teuthology/report.py +++ b/teuthology/report.py @@ -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'}, ) -- 2.39.5