[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: format the content of the download csv file (#463)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

btea
autofix-ci[bot]
and committed by
GitHub
b966dbc8 4e9cd163

+14 -1
+14 -1
app/components/PackageDownloadAnalytics.vue
··· 486 486 ) 487 487 }, 488 488 csv: (csvStr: string) => { 489 - const blob = new Blob([csvStr.replace('data:text/csv;charset=utf-8,', '')]) 489 + // Extract multiline date format template and replace newlines with spaces in CSV 490 + // This ensures CSV compatibility by converting multiline date ranges to single-line format 491 + const PLACEHOLDER_CHAR = '\0' 492 + const multilineDateTemplate = $t('package.downloads.date_range_multiline', { 493 + start: PLACEHOLDER_CHAR, 494 + end: PLACEHOLDER_CHAR, 495 + }) 496 + .replaceAll(PLACEHOLDER_CHAR, '') 497 + .trim() 498 + const blob = new Blob([ 499 + csvStr 500 + .replace('data:text/csv;charset=utf-8,', '') 501 + .replaceAll(`\n${multilineDateTemplate}`, ` ${multilineDateTemplate}`), 502 + ]) 490 503 const url = URL.createObjectURL(blob) 491 504 loadFile( 492 505 url,