mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Fixed error when serving public images from servePublicFile
middleware
no issue - when `servePublicFile` middleware serves an image it resulted in a "Cannot set headers after they are sent to the client" error because `next()` was erroneously called for successful requests which then tripped the `prettyUrls` middleware which tries to perform a redirect - only calling `next()` when an error is present allows errors to be picked up by later middleware but successful requests end in the `servePublicFile` middleware
This commit is contained in:
parent
8def4fb402
commit
02c034068c
1 changed files with 3 additions and 1 deletions
|
@ -30,7 +30,9 @@ function createPublicFileMiddleware(file, type, maxAge) {
|
|||
}));
|
||||
}
|
||||
|
||||
return next(err);
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue