0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 06:50:43 -05:00

Log file errors when performing imageRoute lookup

This commit is contained in:
Chomp 2025-01-09 11:41:47 +00:00
parent bd00542793
commit ae0e271957

View File

@ -1,4 +1,5 @@
import { IncomingMessage, ServerResponse } from "node:http";
import type { ILogger } from "@spt/models/spt/utils/ILogger";
import { ImageRouteService } from "@spt/services/mod/image/ImageRouteService";
import { FileSystemSync } from "@spt/utils/FileSystemSync";
import { HttpFileUtil } from "@spt/utils/HttpFileUtil";
@ -7,6 +8,7 @@ import { inject, injectable } from "tsyringe";
@injectable()
export class ImageRouter {
constructor(
@inject("PrimaryLogger") protected logger: ILogger,
@inject("ImageRouteService") protected imageRouteService: ImageRouteService,
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
) {}
@ -22,6 +24,8 @@ export class ImageRouter {
// send image
if (this.imageRouteService.existsByKey(url)) {
await this.httpFileUtil.sendFileAsync(resp, this.imageRouteService.getByKey(url));
} else {
this.logger.error(`File not found: ${url}`);
}
}