From 0ba9535a1150750b80e862c8fc197819f0f25954 Mon Sep 17 00:00:00 2001 From: Christopher Brickley Date: Thu, 15 Dec 2016 11:44:34 -0500 Subject: [PATCH] fix(discovery): handle discovery urls with $ Some google discovery URLs contain `$discovery` or other variants, causing the calls to wget to interpret `$d` as an environment variable instead of a literal. An example is: `https://logging.googleapis.com/$discovery/rest?version=v2`. To fix this, the `$` has been escaped so that wget fetches the URL as expected. --- src/mako/deps.mako | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 38b16c647f..14584a112e 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -179,11 +179,14 @@ help${agsuffix}: target = target_dir + '/' + name + '-api.json' ## assure the target never actually exists to force him to wget whenver we ask ! fake_target = target + '-force' + ## Some service urls have $ in them. This may cause the console to treat them as env vars. + ## To handle this properly, we need to escape the $. + url = info['discoveryRestUrl'].replace("$", "$$") json_api_targets.append(fake_target) %>\ ${fake_target}: @mkdir -p ${target_dir} - @-wget -nv ${info['discoveryRestUrl']} -O ${target} + @-wget -nv '${url}' -O ${target} % endfor update-json: ${' '.join(json_api_targets)}