mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:10:43 -05:00
Log file errors when performing imageRoute lookup
This commit is contained in:
parent
bd00542793
commit
ae0e271957
@ -1,4 +1,5 @@
|
|||||||
import { IncomingMessage, ServerResponse } from "node:http";
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
|
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
import { ImageRouteService } from "@spt/services/mod/image/ImageRouteService";
|
import { ImageRouteService } from "@spt/services/mod/image/ImageRouteService";
|
||||||
import { FileSystemSync } from "@spt/utils/FileSystemSync";
|
import { FileSystemSync } from "@spt/utils/FileSystemSync";
|
||||||
import { HttpFileUtil } from "@spt/utils/HttpFileUtil";
|
import { HttpFileUtil } from "@spt/utils/HttpFileUtil";
|
||||||
@ -7,6 +8,7 @@ import { inject, injectable } from "tsyringe";
|
|||||||
@injectable()
|
@injectable()
|
||||||
export class ImageRouter {
|
export class ImageRouter {
|
||||||
constructor(
|
constructor(
|
||||||
|
@inject("PrimaryLogger") protected logger: ILogger,
|
||||||
@inject("ImageRouteService") protected imageRouteService: ImageRouteService,
|
@inject("ImageRouteService") protected imageRouteService: ImageRouteService,
|
||||||
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
||||||
) {}
|
) {}
|
||||||
@ -22,6 +24,8 @@ export class ImageRouter {
|
|||||||
// send image
|
// send image
|
||||||
if (this.imageRouteService.existsByKey(url)) {
|
if (this.imageRouteService.existsByKey(url)) {
|
||||||
await this.httpFileUtil.sendFileAsync(resp, this.imageRouteService.getByKey(url));
|
await this.httpFileUtil.sendFileAsync(resp, this.imageRouteService.getByKey(url));
|
||||||
|
} else {
|
||||||
|
this.logger.error(`File not found: ${url}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user