added defensive coding to deal with scenarios where files are deleted but still references from other entities
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user