Skip to content

Commit

Permalink
Revert "Fix code scanning alert no. 8: Uncontrolled data used in path…
Browse files Browse the repository at this point in the history
… expression"

This reverts commit 9a5099a.
  • Loading branch information
thoherr committed Oct 19, 2024
1 parent 9a5099a commit 97f4c93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def csv_import
return redirect_to event_path(@event), notice: I18n.t('only_csv_files_allowed') unless params[:file].content_type == 'text/csv'

if @event
sanitized_file = ActiveStorage::Filename.new(params[:file].original_filename).sanitized
import = CsvExhibitImport.call(@event, sanitized_file)
import = CsvExhibitImport.call(@event, params[:file])
redirect_to event_path(@event),
notice: I18n.t('moc_data_imported_stats_notice', import: import[:ignore_count], import2: import[:failure_count], import3: import[:success_count]),
alert: import[:errors].size > 0 ? I18n.t('failed_moc_ids', inspect: import[:errors].inspect) : nil
Expand Down
2 changes: 1 addition & 1 deletion app/services/csv_exhibit_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def call
success_count = 0;
failure_count = 0
errors = []
opened_file = File.open(Rails.root.join('tmp', @file))
opened_file = File.open(@file)
options = { headers: true, col_sep: ';' }
CSV.foreach(opened_file, **options) do |row|

Expand Down

0 comments on commit 97f4c93

Please sign in to comment.