Skip to content

Commit

Permalink
Don't modify receiver when fixing name.
Browse files Browse the repository at this point in the history
[fixes #93470440]
  • Loading branch information
alexwelch committed Apr 28, 2015
1 parent 8a65544 commit 80715bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/deployment_targets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def token
private

def sanitize_filename(name)
name.gsub!(/[^0-9A-Za-z.\-]/, '_')
name.gsub(/[^0-9A-Za-z.\-]/, '_')
end

def hydrate_index_view
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/deployment_targets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
)
get :token, id: 7
end

it 'properly sanitizes names' do
allow(fake_target).to receive(:name).and_return('foo')
expect(controller).to receive(:send_data).with(
'blob',
filename: 'foo.txt',
type: 'text/plain'
)
get :token, id: 7
end
end

describe 'GET #index' do
Expand Down

0 comments on commit 80715bd

Please sign in to comment.