From 2b67f353ce40a9433b5e5248c9c42cb4614d8717 Mon Sep 17 00:00:00 2001 From: Jacob Dunphy Date: Tue, 8 Dec 2009 18:11:12 -0800 Subject: [PATCH] Handle paths with leading slashes, and without. --- print_json_response | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/print_json_response b/print_json_response index 8ac9234..530cd36 100755 --- a/print_json_response +++ b/print_json_response @@ -19,9 +19,8 @@ end def process_url(url) if url !~ /\Ahttp/ - p = url.split('/').compact - p.unshift(DEFAULT_HOST) - url = p.join('/') + url = '/' + url unless url.start_with?('/') + url = DEFAULT_HOST + url end puts "Retrieving #{url}:"