Skip to content

Commit

Permalink
Omit the brackets around IPv6 addresses when building URIs for VMRC
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Jun 22, 2017
1 parent 3e156df commit 6de83af
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/controllers/vm_remote.rb
Expand Up @@ -46,12 +46,7 @@ def launch_vmware_console
:api_version => @record.ext_management_system.api_version.to_s,
:os => browser_info(:os),
:name => @record.name,
:vmrc_uri => URI::Generic.build(:scheme => "vmrc",
:userinfo => "clone:#{params[:ticket]}",
:host => host,
:port => 443,
:path => "/",
:query => "moid=#{vmid}")
:vmrc_uri => build_vmrc_uri(host, vmid, ticket)
}
end
render :template => "vm_common/console_#{console_type}",
Expand Down Expand Up @@ -129,4 +124,15 @@ def console_after_task(console_type)
javascript_open_window(url)
end
end

def build_vmrc_uri(host, vmid, ticket)
uri = URI::Generic.build(:scheme => "vmrc",
:userinfo => "clone:#{ticket}",
:host => host,
:port => 443,
:path => "/",
:query => "moid=#{vmid}").to_s
# VMRC doesn't like brackets around IPv6 addresses
uri.sub(/(.*)\[/, '\1').sub(/(.*)\]/, '\1')
end
end

0 comments on commit 6de83af

Please sign in to comment.