Skip to content

Commit

Permalink
Merge pull request #774 from numerique-gouv/fix-startwith-error
Browse files Browse the repository at this point in the history
fix: undefined baseUrl makes the app crash
  • Loading branch information
rdubigny authored Oct 21, 2024
2 parents a3b7e31 + 31a948d commit bb8c137
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if (FEATURE_USE_SECURITY_RESPONSE_HEADERS) {
app.set("etag", false);

let morganOption: morgan.Options<Request, Response> = {
skip: (req: Request, _res: Response) => req.baseUrl.startsWith("/dist"),
skip: (req: Request, _res: Response) => req.baseUrl?.startsWith("/dist"),
};
if (ACCESS_LOG_PATH) {
morganOption.stream = fs.createWriteStream(ACCESS_LOG_PATH, { flags: "a" });
Expand Down

0 comments on commit bb8c137

Please sign in to comment.