Fix UUID validation

This commit is contained in:
Casper Warden
2025-06-19 17:49:02 +01:00
parent 7d67d4b175
commit 3a6aaac4be
6 changed files with 4656 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ import { InventoryLibrary } from '../enums/InventoryLibrary';
import { LandStatsEvent } from '../events/LandStatsEvent';
import * as LLSD from '@caspertech/llsd';
import type { CancelableRequest, Response } from 'got';
import type { CancelableRequest, Response as GotResponse } from 'got';
import got from 'got';
import * as Long from 'long';
@@ -30,7 +30,7 @@ export class EventQueueClient
public ack?: number;
public done = false;
private currentRequest?: CancelableRequest<Response<string>> = undefined;
private currentRequest?: CancelableRequest<GotResponse<string>> = undefined;
private readonly clientEvents: ClientEvents;
private readonly agent: Agent;
@@ -578,7 +578,7 @@ export class EventQueueClient
}
public async request(url: string, data: string, contentType: string): Promise<string>
{
let req: CancelableRequest<Response<string>> | undefined = undefined;
let req: CancelableRequest<GotResponse<string>> | undefined = undefined;
try
{
req = got.post(url, {

View File

@@ -76,7 +76,7 @@ export class UUID
}
if (typeof obj[param] === 'string')
{
if (validator.isUUID(obj[param]))
if (validator.isUUID(obj[param], 'loose'))
{
return new UUID(obj[param]);
}
@@ -89,7 +89,7 @@ export class UUID
const u = obj[param].UUID[0];
if (typeof u === 'string')
{
if (validator.isUUID(u))
if (validator.isUUID(u, 'loose'))
{
return new UUID(u);
}
@@ -105,7 +105,7 @@ export class UUID
public setUUID(val: string): boolean
{
const test = val.trim();
if (validator.isUUID(test))
if (validator.isUUID(test, 'loose'))
{
this.mUUID = test;
return true;