diff options
author | Joshua Timberman <joshua@opscode.com> | 2013-04-10 13:12:11 -0700 |
---|---|---|
committer | Joshua Timberman <joshua@opscode.com> | 2013-04-10 13:12:11 -0700 |
commit | 20997cecfd232db9ed5b29a0e6f637239599d0df (patch) | |
tree | e150dceb631bece589cec26a12ad6b1812cc1aec | |
parent | d90c65efe9d3bfe1cd0a1d005d78c1c53d24fe87 (diff) | |
parent | cbeb613d362eb753c4eb622d7f224c3a20f48f84 (diff) | |
download | mixlib-shellout-20997cecfd232db9ed5b29a0e6f637239599d0df.tar.gz |
Merge pull request #32 from opscode-cookbooks/jtimberman/COOK-2729
[COOK-2729] - use stdlib URI class
-rw-r--r-- | libraries/helper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libraries/helper.rb b/libraries/helper.rb index 0cf9ddd..f8ac89d 100644 --- a/libraries/helper.rb +++ b/libraries/helper.rb @@ -17,6 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +require 'uri' module Windows module Helper @@ -64,8 +65,9 @@ module Windows def cached_file(source, checksum=nil, windows_path=true) @installer_file_path ||= begin - if(source =~ /^(https?:\/\/)(.*\/)(.*)$/) - cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(source)}" + if ::URI.parse(source).absolute? + uri = ::URI.parse(::URI.unescape(source)) + cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(uri.path)}" Chef::Log.debug("Caching a copy of file #{source} at #{cache_file_path}") r = Chef::Resource::RemoteFile.new(cache_file_path, run_context) r.source(source) |