Fix tempFileMiddleware that was serving a cached .well-known file

Ticket: 1386

The code was caching the first result and returning that.

We would expand the cache for multiple files, that that also require checking if the file has changed, so just read the content every time -- I think the file is small enough?
This commit is contained in:
infinite-persistence 2022-04-28 18:06:38 +08:00 committed by Thomas Zarebczan
parent b9525229f9
commit 73d68c1db2

View file

@ -1,13 +1,9 @@
const fs = require('fs');
const path = require('path');
let tempFile;
async function getTempFile(ctx) {
const filename = ctx.params.filename;
if (!tempFile) {
tempFile = fs.readFileSync(path.join(__dirname, `/../dist/${filename}`), 'utf8');
}
return tempFile;
return fs.readFileSync(path.join(__dirname, `/../dist/${filename}`), 'utf8');
}
module.exports = { getTempFile };