added defensive coding to deal with scenarios where files are deleted but still references from other entities

This commit is contained in:
Shaun Walker
2020-04-14 12:18:11 -04:00
parent de5eeb08c4
commit 70ebd6eb35
5 changed files with 92 additions and 38 deletions

View File

@ -56,7 +56,14 @@ namespace Oqtane.Services
public async Task<File> GetFileAsync(int fileId)
{
return await _http.GetJsonAsync<File>($"{Apiurl}/{fileId.ToString()}");
try
{
return await _http.GetJsonAsync<File>($"{Apiurl}/{fileId.ToString()}");
}
catch
{
return null;
}
}
public async Task<File> AddFileAsync(File file)