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
@ -52,6 +52,8 @@ internal static class RoutingExtensions
|
||||
internal static RouteHandlerBuilder MapRemoteFile(this IEndpointRouteBuilder endpoints, [StringSyntax("Route")] string path, string contentType, string source, string? integrity = null)
|
||||
{
|
||||
return endpoints.MapGet(path, async (context) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string fileName = Path.GetFileName(path);
|
||||
byte[] data = await StaticContentLoader.LoadRemote(path, source, integrity);
|
||||
@ -63,6 +65,11 @@ internal static class RoutingExtensions
|
||||
{
|
||||
await Results.Bytes(data, contentType, fileName).ExecuteAsync(context);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Results.InternalServerError(ex.ToString()).ExecuteAsync(context);
|
||||
}
|
||||
}).Produces<byte[]>(StatusCodes.Status200OK, contentType);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user