Skip to content

Commit

Permalink
fix dvd path that crash if do not contain path (bnc#938786)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jul 21, 2015
1 parent bbdad18 commit c6a24e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/SourceDialogs.rb
Expand Up @@ -2266,8 +2266,11 @@ def SelectStore(key, event)
@_url = "smb://"
elsif selected == :nfs
@_url = "nfs://"
# this case is specific, as it return complete path and not just
# prefix as others
elsif selected == :cd || selected == :dvd
@_url = selected == :cd ? "cd://" : "dvd://"
# use three slashes as third slash means path
@_url = selected == :cd ? "cd:///" : "dvd:///"
if @cd_device_name != ""
@_url = Ops.add(
Ops.add(@_url, "?devices="),
Expand Down
11 changes: 11 additions & 0 deletions test/source_dialogs_test.rb
Expand Up @@ -80,4 +80,15 @@
expect(subject.URLScheme("test")).to eq "url"
end
end

describe ".SelectStore" do
it "sets url to full url for DVD and CD selection" do
allow(Yast::UI).to receive(:QueryWidget).with(Id(:type), :CurrentButton)
.and_return(:dvd)

described_class.SelectStore(:type, {})

expect(described_class.instance_variable_get("@_url")).to eq "dvd:///"
end
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Expand Up @@ -8,3 +8,4 @@
end

require "yast"
require "yast/rspec"

0 comments on commit c6a24e8

Please sign in to comment.