Skip to content

Commit

Permalink
Removing invalid [FromForm] from TenantApiController.Setup (#16439)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piedone authored Jul 14, 2024
1 parent be2d46b commit 29cd5fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public async Task<IActionResult> Remove(string tenantName)

[HttpPost]
[Route("setup")]
public async Task<ActionResult> Setup(SetupApiViewModel model, [FromForm] IFormFile recipe = null)
public async Task<ActionResult> Setup(SetupApiViewModel model)
{
if (!_currentShellSettings.IsDefaultShell())
{
Expand Down Expand Up @@ -393,17 +393,14 @@ public async Task<ActionResult> Setup(SetupApiViewModel model, [FromForm] IFormF

if (string.IsNullOrEmpty(recipeName))
{
if (recipe == null)
if (model.Recipe == null)
{
return BadRequest(S["Either a 'recipe' file or 'RecipeName' is required."]);
}

var tempFilename = Path.GetTempFileName();

using (var fs = System.IO.File.Create(tempFilename))
{
await recipe.CopyToAsync(fs);
}
await System.IO.File.WriteAllTextAsync(tempFilename, model.Recipe);

var fileProvider = new PhysicalFileProvider(Path.GetDirectoryName(tempFilename));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ public class SetupApiViewModel
[DataType(DataType.Password)]
public string Password { get; set; }

/// <summary>
/// The name of a recipe available in the app.
/// </summary>
public string RecipeName { get; set; }

/// <summary>
/// A JSON string representing a custom recipe.
/// </summary>
public string Recipe { get; set; }

public string SiteTimeZone { get; set; }

public string Schema { get; set; }
Expand Down

0 comments on commit 29cd5fb

Please sign in to comment.