POS and Crowdfund: Improve item editor (#5418)

* POS and Crowdfund: Improve item editor

Makes it work the same way as the form editor: Drag and drop for reordering and inline editing without modal.

* Upload component
This commit is contained in:
d11n
2023-11-02 19:58:03 +01:00
committed by GitHub
parent c979c4774c
commit c16dfb2dcb
18 changed files with 702 additions and 644 deletions

View File

@@ -228,13 +228,17 @@ namespace BTCPayServer.Controllers
if (app is null || userId is null)
return NotFound();
if (!file.FileName.IsValidFileName())
{
return Json(new { error = "Invalid file name" });
}
if (!file.ContentType.StartsWith("image/", StringComparison.InvariantCulture))
{
return Json(new { error = "The file needs to be an image" });
}
if (file.Length > 500_000)
{
return Json(new { error = "The image file size should be less than 0.5MB" });
return Json(new { error = "The file size should be less than 0.5MB" });
}
var formFile = await file.Bufferize();
if (!FileTypeDetector.IsPicture(formFile.Buffer, formFile.FileName))