Skip to content

Commit

Permalink
add safe filename
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-roca committed Jul 14, 2023
1 parent b47cf70 commit c9017d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/junit/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {AxiosPromise, AxiosRequestConfig, AxiosResponse} from 'axios'

import FormData from 'form-data'

import {replaceForwardSlashes} from '../../helpers/file'
import {getSafeFilename} from '../../helpers/file'
import {getRequestBuilder} from '../../helpers/utils'

import {Payload} from './interfaces'
Expand Down Expand Up @@ -43,6 +43,7 @@ export const uploadJUnitXML = (request: (args: AxiosRequestConfig) => AxiosPromi
session: reportTagsAndMetrics,
'_dd.cireport_version': '3',
'_dd.hostname': jUnitXML.hostname,
'_dd.report_name': fileName,
}

if (jUnitXML.logsEnabled) {
Expand All @@ -56,7 +57,7 @@ export const uploadJUnitXML = (request: (args: AxiosRequestConfig) => AxiosPromi
form.append('event', JSON.stringify(custom), {filename: 'event.json'})

form.append('junit_xml_report_file', fs.createReadStream(jUnitXML.xmlPath).pipe(createGzip()), {
filename: `${replaceForwardSlashes(fileName)}.xml.gz`,
filename: `${getSafeFilename(fileName)}.xml.gz`,
})

return request({
Expand Down

0 comments on commit c9017d4

Please sign in to comment.