Skip to content

Commit

Permalink
Fixed large file upload. Added .mkv support. Fixes impworks#170.
Browse files Browse the repository at this point in the history
  • Loading branch information
impworks committed Aug 11, 2020
1 parent c933d50 commit 48bc40c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Bonsai/Areas/Admin/Controllers/MediaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Bonsai.Areas.Admin.Logic;
using Bonsai.Areas.Admin.Logic.Workers;
using Bonsai.Areas.Admin.Utils;
using Bonsai.Areas.Admin.ViewModels.Media;
using Bonsai.Areas.Front.Logic;
using Bonsai.Code.DomainModel.Media;
Expand All @@ -15,6 +16,8 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;

namespace Bonsai.Areas.Admin.Controllers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public VideoMediaHandler(IHostingEnvironment env)
{
"video/mp4",
"video/x-flv",
"video/ogg",
"video/quicktime",
"video/x-msvideo",
"video/x-matroska"
};

/// <summary>
Expand Down
12 changes: 11 additions & 1 deletion src/Bonsai/Code/Config/Startup.Services.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Bonsai.Areas.Admin.Logic;
using System;
using Bonsai.Areas.Admin.Logic;
using Bonsai.Areas.Admin.Logic.Changesets;
using Bonsai.Areas.Admin.Logic.MediaHandlers;
using Bonsai.Areas.Admin.Logic.Validation;
Expand All @@ -8,6 +9,7 @@
using Bonsai.Areas.Front.Logic.Relations;
using Bonsai.Code.Services;
using Bonsai.Code.Services.Config;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;

namespace Bonsai.Code.Config
Expand All @@ -19,6 +21,14 @@ public partial class Startup
/// </summary>
private void ConfigureAppServices(IServiceCollection services)
{
services.Configure<FormOptions>(x =>
{
// actual value set in config via ConfigurableRequestSizeLimitFilter
x.MemoryBufferThreshold = int.MaxValue;
x.ValueLengthLimit = int.MaxValue;
x.MultipartBodyLengthLimit = int.MaxValue;
});

services.AddNodeServices(x =>
{
x.InvocationTimeoutMilliseconds = 1800000; // 30 min must be enough?
Expand Down
10 changes: 10 additions & 0 deletions src/Bonsai/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>
</configuration>

0 comments on commit 48bc40c

Please sign in to comment.