mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Minify: Don't set cache headers if statFile()
causes 500
This commit is contained in:
parent
84190793dc
commit
3eefe71834
1 changed files with 6 additions and 4 deletions
|
@ -146,6 +146,11 @@ const minify = (req, res) => {
|
|||
const contentType = mime.lookup(filename);
|
||||
|
||||
util.callbackify(statFile)(filename, 3, (error, [date, exists]) => {
|
||||
if (error) {
|
||||
res.writeHead(500, {});
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
if (date) {
|
||||
date = new Date(date);
|
||||
date.setMilliseconds(0);
|
||||
|
@ -158,10 +163,7 @@ const minify = (req, res) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
res.writeHead(500, {});
|
||||
res.end();
|
||||
} else if (!exists) {
|
||||
if (!exists) {
|
||||
res.writeHead(404, {});
|
||||
res.end();
|
||||
} else if (new Date(req.headers['if-modified-since']) >= date) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue