diff options
| author | Hazel K <acomputerdog@gmail.com> | 2024-10-02 12:47:01 -0400 |
|---|---|---|
| committer | Hazel K <acomputerdog@gmail.com> | 2024-10-02 12:47:01 -0400 |
| commit | 3defed6a190a1771fbc91c9c62c25da01dc78b55 (patch) | |
| tree | da789a2daf10a44417bbe81c23a0d841d192a9a2 | |
| parent | merge: fix type error for sidebarLogoUrl (!641) (diff) | |
| download | sharkey-3defed6a190a1771fbc91c9c62c25da01dc78b55.tar.gz sharkey-3defed6a190a1771fbc91c9c62c25da01dc78b55.tar.bz2 sharkey-3defed6a190a1771fbc91c9c62c25da01dc78b55.zip | |
fix exception when logging IP addresses
| -rw-r--r-- | packages/backend/src/server/api/ApiCallService.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts index 808795fdac..2307e172d5 100644 --- a/packages/backend/src/server/api/ApiCallService.ts +++ b/packages/backend/src/server/api/ApiCallService.ts @@ -260,6 +260,11 @@ export class ApiCallService implements OnApplicationShutdown { const meta = await this.metaService.fetch(); if (!meta.enableIpLogging) return; const ip = request.ip; + if (!ip) { + this.logger.warn(`user ${user.id} has a null IP address; please check your network configuration.`); + return; + } + const ips = this.userIpHistories.get(user.id); if (ips == null || !ips.has(ip)) { if (ips == null) { |