fix: lint

Signed-off-by: acalcutt <acalcutt@techidiots.net>
This commit is contained in:
acalcutt 2023-11-02 11:44:17 -04:00 committed by Andrew Calcutt
parent 426038a713
commit 70d8ddc476
2 changed files with 18 additions and 13 deletions

View file

@ -277,14 +277,18 @@ fs.stat(path.resolve(opts.config), (err, stats) => {
axios({
url,
method: 'GET',
responseType: 'stream'
}).then(response => {
response.data.pipe(writer);
writer.on('finish', () => StartWithInputFile(filename));
writer.on('error', err => console.error(`Error writing file: ${err}`));
}).catch(error => {
console.error(`Error downloading file: ${error}`);
});
responseType: 'stream',
})
.then((response) => {
response.data.pipe(writer);
writer.on('finish', () => StartWithInputFile(filename));
writer.on('error', (err) =>
console.error(`Error writing file: ${err}`),
);
})
.catch((error) => {
console.error(`Error downloading file: ${error}`);
});
}
}
} else {

View file

@ -1358,13 +1358,15 @@ export const serve_rendered = {
responseType: 'arraybuffer', // Get the response as raw buffer
// Axios handles gzip by default, so no need for a gzip flag
});
const responseHeaders = response.headers;
const responseData = response.data;
const parsedResponse = {};
if (responseHeaders['last-modified']) {
parsedResponse.modified = new Date(responseHeaders['last-modified']);
parsedResponse.modified = new Date(
responseHeaders['last-modified'],
);
}
if (responseHeaders.expires) {
parsedResponse.expires = new Date(responseHeaders.expires);
@ -1372,10 +1374,9 @@ export const serve_rendered = {
if (responseHeaders.etag) {
parsedResponse.etag = responseHeaders.etag;
}
parsedResponse.data = responseData;
callback(null, parsedResponse);
} catch (error) {
const parts = url.parse(req.url);
const extension = path.extname(parts.pathname).toLowerCase();