Merge pull request #3677 from sbwalker/dev
improvements to .NET MAUI file upload based on #3674 (credit @thabaum)
This commit is contained in:
commit
245a3a73d8
|
@ -20,6 +20,7 @@ using SixLabors.ImageSharp;
|
|||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Formats.Png;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
|
||||
// ReSharper disable StringIndexOfIsCultureSpecific.1
|
||||
|
||||
|
@ -358,6 +359,7 @@ namespace Oqtane.Controllers
|
|||
}
|
||||
|
||||
// POST api/<controller>/upload
|
||||
[EnableCors(Constants.MauiCorsPolicy)]
|
||||
[HttpPost("upload")]
|
||||
public async Task UploadFile(string folder, IFormFile formfile)
|
||||
{
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace Oqtane
|
|||
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(Constants.MauiUserAgent,
|
||||
options.AddPolicy(Constants.MauiCorsPolicy,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("https://0.0.0.0", "http://0.0.0.0", "app://0.0.0.0")
|
||||
|
@ -186,11 +186,11 @@ namespace Oqtane
|
|||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseCors(Constants.MauiUserAgent);
|
||||
app.UseTenantResolution();
|
||||
app.UseJwtAuthorization();
|
||||
app.UseBlazorFrameworkFiles();
|
||||
app.UseRouting();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ namespace Oqtane.Shared
|
|||
|
||||
public static readonly string MauiUserAgent = "MAUI";
|
||||
public static readonly string MauiAliasPath = "Alias-Path";
|
||||
public const string MauiCorsPolicy = "MauiCorsPolicy"; // must be a constant to be used with an attribute
|
||||
|
||||
public static readonly string VisitorCookiePrefix = "APP_VISITOR_";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user