Refactor SettingsGetInformationField and PeerInformationManager to improve error handling and validate UUID format

https://github.com/nosial/Socialbox-PHP/issues/60
This commit is contained in:
netkas 2025-03-12 15:13:42 -04:00
parent d127393402
commit f51ea0bd78
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
2 changed files with 5 additions and 0 deletions

View file

@ -25,6 +25,7 @@
{
throw new MissingRpcArgumentException('field');
}
$fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field')));
if($fieldName === null)
{

View file

@ -208,6 +208,10 @@
{
$peerUuid = $peerUuid->getUuid();
}
elseif(!Validator::validateUuid($peerUuid))
{
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
}
try
{