Skip to content

Commit

Permalink
properly escape spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 1, 2017
1 parent d413a36 commit 62f66a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/modules/SourceDialogs.rb
Expand Up @@ -343,7 +343,9 @@ def PostprocessISOURL(url)
params["url"] = URI.unescape(new_url.to_s)

processed = URI("")
processed.query = URI.encode_www_form(params)
# libzypp do not use web encoding as in https://www.w3.org/TR/html5/forms.html#url-encoded-form-data
# but percentage enconding only. For more details see (bsc#954813#c20)
processed.query = URI.encode_www_form(params).gsub(/\+/, "%20")

ret = "iso:///" + processed.to_s
log.info "Updated URL: #{URL.HidePassword(ret)}"
Expand Down
2 changes: 1 addition & 1 deletion test/source_dialogs_test.rb
Expand Up @@ -68,7 +68,7 @@

it "prevents double escaping if get already escaped string" do
converted = "iso:///install/Duomenys%20600%20GB/openSUSE-13.2-DVD-x86_64.iso"
url = "iso:///?iso=openSUSE-13.2-DVD-x86_64.iso&url=dir%3A%2Finstall%2FDuomenys+600+GB"
url = "iso:///?iso=openSUSE-13.2-DVD-x86_64.iso&url=dir%3A%2Finstall%2FDuomenys%20600%20GB"

expect(subject.PostprocessISOURL(converted)).to eq(url)
end
Expand Down

0 comments on commit 62f66a6

Please sign in to comment.