Ensure that the export CSV inventory items are in UTF-8 [SCI-9307] (#6590)

This commit is contained in:
Soufiane 2023-11-07 15:02:19 +01:00 committed by GitHub
parent 3f4c6c8095
commit 2bd84a12e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -328,6 +328,7 @@ class RepositoriesController < ApplicationController
render json: {
html: render_to_string(
partial: 'shared/flash_errors',
formats: :html,
locals: { error_title: t('repositories.import_records.error_message.errors_list_title'),
error: t('repositories.import_records.error_message.no_repository_name') }
)

View file

@ -35,7 +35,7 @@ class RepositoryZipExportJob < ZipExportJob
repository,
nil,
params[:my_module_id].present?)
File.binwrite("#{dir}/export.csv", data)
File.binwrite("#{dir}/export.csv", data.encode('UTF-8', invalid: :replace, undef: :replace))
end
def failed_notification_title