Browse Source

Fallback when resizing failed.

pull/556/head
Sebastian 5 years ago
parent
commit
bb7f28b364
  1. 13
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

13
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

@ -21,6 +21,7 @@ using Squidex.Infrastructure.Assets;
using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Log;
using Squidex.Web;
using ThirdParty.BouncyCastle.Asn1;
#pragma warning disable 1573
@ -201,8 +202,16 @@ namespace Squidex.Areas.Api.Controllers.Assets
using (Profiler.Trace("ResizeImage"))
{
await assetThumbnailGenerator.CreateThumbnailAsync(sourceStream, destinationStream, resizeOptions);
destinationStream.Position = 0;
try
{
await assetThumbnailGenerator.CreateThumbnailAsync(sourceStream, destinationStream, resizeOptions);
destinationStream.Position = 0;
}
catch
{
sourceStream.Position = 0;
await sourceStream.CopyToAsync(destinationStream);
}
}
using (Profiler.Trace("ResizeUpload"))

Loading…
Cancel
Save