Skip to content

Commit

Permalink
Merge pull request #4126 from OSC/ps-url-bugfix
Browse files Browse the repository at this point in the history
ensure filenames are not url encoded (#4107)
  • Loading branch information
johrstrom authored Feb 10, 2025
2 parents 3dfeb55 + 895a82a commit 6ae8278
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class PathSelectorTable {
}

setLastVisited(path, pathType = 'd') {
const item = { path: path, type: pathType };
const item = { path: decodeURI(path), type: pathType };
if(path) {
localStorage.setItem(this.storageKey(), JSON.stringify(item));
}
Expand Down
37 changes: 37 additions & 0 deletions apps/dashboard/test/system/batch_connect_widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,43 @@ def make_bc_app(dir, form)
end
end

test 'path_selector will not have URL encoded data' do
Dir.mktmpdir do |dir|
"#{dir}/app".tap { |d| Dir.mkdir(d) }
SysRouter.stubs(:base_path).returns(Pathname.new(dir))
stub_scontrol
stub_sacctmgr
stub_git("#{dir}/app")
base_id = 'batch_connect_session_context_path'
filename = "#{Rails.root}/tmp/file with spaces"
FileUtils.touch(filename)

form = <<~HEREDOC
---
cluster:
- owens
form:
- path
attributes:
path:
widget: 'path_selector'
directory: "#{Rails.root}/tmp"
HEREDOC

Pathname.new("#{dir}/app/").join('form.yml').write(form)

visit new_batch_connect_session_context_url('sys/app')

click_on 'Select Path'
sleep 0.5

find('span', text: 'file with spaces').click
find("##{base_id}_path_selector_button").click

assert_equal(filename, find("##{base_id}").value)
end
end

test 'data-label-* allows select options to dynamically change the label of another form element' do
Dir.mktmpdir do |dir|
"#{dir}/app".tap { |d| Dir.mkdir(d) }
Expand Down

0 comments on commit 6ae8278

Please sign in to comment.