mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
Catch exceptions while loading remote files
This commit is contained in:
parent
07563989e1
commit
48bd179426
@ -53,15 +53,22 @@ internal static class RoutingExtensions
|
||||
{
|
||||
return endpoints.MapGet(path, async (context) =>
|
||||
{
|
||||
string fileName = Path.GetFileName(path);
|
||||
byte[] data = await StaticContentLoader.LoadRemote(path, source, integrity);
|
||||
if (data.Length == 0)
|
||||
try
|
||||
{
|
||||
await Results.NotFound().ExecuteAsync(context);
|
||||
string fileName = Path.GetFileName(path);
|
||||
byte[] data = await StaticContentLoader.LoadRemote(path, source, integrity);
|
||||
if (data.Length == 0)
|
||||
{
|
||||
await Results.NotFound().ExecuteAsync(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Results.Bytes(data, contentType, fileName).ExecuteAsync(context);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Results.Bytes(data, contentType, fileName).ExecuteAsync(context);
|
||||
await Results.InternalServerError(ex.ToString()).ExecuteAsync(context);
|
||||
}
|
||||
}).Produces<byte[]>(StatusCodes.Status200OK, contentType);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user