parent
4f7938726e
commit
da1b5765c7
|
@ -31,9 +31,13 @@ module Vagrant
|
|||
@download_interrupted = false
|
||||
|
||||
unless env[:box_name].nil?
|
||||
begin
|
||||
if URI.parse(env[:box_name]).kind_of?(URI::HTTP)
|
||||
env[:ui].warn(I18n.t("vagrant.box_add_url_warn"))
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
# do nothing
|
||||
end
|
||||
end
|
||||
|
||||
url = Array(env[:box_url]).map do |u|
|
||||
|
|
|
@ -305,6 +305,28 @@ describe Vagrant::Action::Builtin::BoxAdd, :skip_windows do
|
|||
end
|
||||
end
|
||||
|
||||
context "with a box name containing invalid URI characters" do
|
||||
it "should not raise an error" do
|
||||
box_path = iso_env.box2_file(:virtualbox)
|
||||
with_web_server(box_path) do |port|
|
||||
|
||||
box_url_name = "box name with spaces"
|
||||
env[:box_name] = box_url_name
|
||||
|
||||
expect(box_collection).to receive(:add).with { |path, name, version, **opts|
|
||||
expect(name).to eq(box_url_name)
|
||||
expect(version).to eq("0")
|
||||
expect(opts[:metadata_url]).to be_nil
|
||||
true
|
||||
}.and_return(box)
|
||||
|
||||
expect(app).to receive(:call).with(env)
|
||||
|
||||
subject.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with URL containing credentials" do
|
||||
let(:username){ "box-username" }
|
||||
let(:password){ "box-password" }
|
||||
|
|
Loading…
Reference in New Issue