further hardening.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-10-28 09:19:09 -06:00
parent 4c6ac96dd1
commit cff7845dd4
2 changed files with 43 additions and 13 deletions

View File

@@ -127,6 +127,14 @@ namespace CarCareTracker.Helper
{
return new OperationResponse { Success = false, Message = "The translation file name en_US is reserved." };
}
if (string.IsNullOrWhiteSpace(userLanguage))
{
return new OperationResponse { Success = false, Message = "File name is not provided." };
}
if (!translations.Any())
{
return new OperationResponse { Success = false, Message = "Translation has no data." };
}
var translationFilePath = _fileHelper.GetFullFilePath($"/translations/{userLanguage}.json", false);
try
{