diff --git a/app/src/components/carboneCopyApi.js b/app/src/components/carboneCopyApi.js index a5357e1..3992d1d 100644 --- a/app/src/components/carboneCopyApi.js +++ b/app/src/components/carboneCopyApi.js @@ -14,12 +14,12 @@ const carboneCopyApi = { carboneRender.carboneSet(); }, - findAndRender: (hash, req, res) => { + findAndRender: async (hash, req, res) => { const template = fileCache.find(hash); if (!template.success) { new Problem(template.errorType, { detail: template.errorMsg }).send(res); } else { - return carboneCopyApi.renderTemplate(template, req, res); + return await carboneCopyApi.renderTemplate(template, req, res); } }, diff --git a/app/src/components/fileCache.js b/app/src/components/fileCache.js index b240672..f73c6b6 100644 --- a/app/src/components/fileCache.js +++ b/app/src/components/fileCache.js @@ -63,14 +63,16 @@ class FileCache { if (!fs.existsSync(hashPath)) { result.errorType = 404; result.errorMsg = `Hash '${hash}' not found.`; + log.error(`Hash '${hash}' not found.`, { function: 'fileCache.find', result }); return result; } result.hash = hash; const files = fs.readdirSync(hashPath); - if (!files || files.length !== 1) { + if (!files || files.length === 0) { result.errorType = 404; result.errorMsg = 'Hash found; could not read file from cache.'; + log.error('Hash found. could not read file from cache', { function: 'fileCache.find', result }); return result; } else { result.name = files[0]; @@ -121,9 +123,10 @@ class FileCache { } const hashPath = this._getHashPath(result.hash); - // if file exists at temp file path + // if template exists if (fs.existsSync(hashPath)) { if (options.overwrite) { + // remove template fs.removeSync(hashPath); } else { // Remove temporary file from cache diff --git a/charts/cdogs/values.yaml b/charts/cdogs/values.yaml index a004ae0..f514896 100644 --- a/charts/cdogs/values.yaml +++ b/charts/cdogs/values.yaml @@ -207,7 +207,7 @@ fluentBit: # -- Default image repository repository: docker.io/fluent # -- Default image tag - tag: "3.1.0" + tag: "2.2.2" resources: # We usually recommend not to specify default resources and to leave this as a conscious