Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Fix unescaped characters in Datastore URLs (#183)
Browse files Browse the repository at this point in the history
URI.escape doesn't escape some characters that are valid in datacenter,
datastore and folder names. Eg. &, ?, =, (, ). This can lead to invalid
URLs being generated.
Using URI.encode_www_form_component should correctly escape these
characters.
  • Loading branch information
TomGiordano committed Aug 27, 2020
1 parent ada68a5 commit c663545
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rbvmomi/vim/Datastore.rb
Expand Up @@ -67,6 +67,6 @@ def datacenter

def mkuripath path
datacenter_path_str = datacenter.path[1..-1].map{|elem| elem[1]}.join('/')
"/folder/#{URI.escape path}?dcPath=#{URI.escape datacenter_path_str }&dsName=#{URI.escape name}"
"/folder/#{URI.encode_www_form_component path}?dcPath=#{URI.encode_www_form_component datacenter_path_str }&dsName=#{URI.encode_www_form_component name}"
end
end

0 comments on commit c663545

Please sign in to comment.