Skip to content

Commit

Permalink
fix: asset name in logs [ZEND-5790] (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjolton-contentful authored Jan 7, 2025
1 parent da79c44 commit e34672c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/tasks/download-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ export default function downloadAssets (options) {
})

return Promise.map(ctx.data.assets, (asset) => {
const entityName = getEntityName(asset)
if (!asset.fields.file) {
task.output = `${figures.warning} asset ${getEntityName(asset)} has no file(s)`
task.output = `${figures.warning} asset ${entityName} has no file(s)`
warningCount++
return
}
const locales = Object.keys(asset.fields.file)
return Promise.mapSeries(locales, (locale) => {
const url = asset.fields.file[locale].url
if (!url) {
task.output = `${figures.cross} asset '${getEntityName(asset)}' doesn't contain an url in path asset.fields.file[${locale}].url`
task.output = `${figures.cross} asset '${entityName}' doesn't contain an url in path asset.fields.file[${locale}].url`
errorCount++

return Promise.resolve()
Expand All @@ -89,7 +90,7 @@ export default function downloadAssets (options) {
return startingPromise
.then(downloadAsset)
.then((downLoadedFile) => {
task.output = `${figures.tick} downloaded ${getEntityName(downLoadedFile)} (${url})`
task.output = `${figures.tick} downloaded ${entityName} (${url})`
successCount++
})
.catch((error) => {
Expand Down

0 comments on commit e34672c

Please sign in to comment.