Use normalized license data in csv export
What does this MR do and why?
Part of https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/3818
When exporting a license's usage data to csv, the file included the stored data from the database. For some licenses, this led to the license key to contain carriage returns (see more info in this comment) that made the file unreadable with CSV.read
.
This change will use the normalized data that removes any carriage returns from the license data.`
How to set up and validate locally
General:
- In CustomersDot, create a new offline license in the admin area.
- Upload the newly created license to your GitLab instance.
Without this change:
- Go to
/admin/subscription
. - Download the license usage file by clicking the "Export license usage data" button.
- In a rails console read the downloaded file with
CSV.read(<path_to_file>)
. - This should raise an error like this one:
CSV::MalformedCSVError: Any value after quoted field isn't allowed in line 1.
With this change:
- Go to
/admin/subscription
. - Download the license usage file by clicking the "Export license usage data" button.
- In a rails console read the downloaded file with
CSV.read(<path_to_file>)
. - The file should be readable and not raise an error.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Corinna Gogolok