Skip to content

Commit

Permalink
add relative root for image
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Valkenburg committed Jun 17, 2024
1 parent 6b02b3a commit 09fd79e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Talpa Api/Controllers/Api/CustomizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ public IActionResult UpdateCustomization(string? name, bool? gradient, string? c
return BadRequest();
}

var path = Path.Combine("wwwroot", "images", "logo." + Path.GetExtension(image.FileName));
var stream = new FileStream(path, FileMode.Create);
var path = Path.Combine("wwwroot", "logo", image.FileName);

image.CopyTo(stream);
try
{
if (!Directory.Exists(Path.Combine("wwwroot", "logo"))) Directory.CreateDirectory(Path.Combine("wwwroot", "logo"));

var stream = new FileStream(path, FileMode.Create);

image.CopyTo(stream);
}
catch (Exception ex)
{
return StatusCode(503, "Image write unavailable: " + ex);
}
}

if (currentCustomization is null)
Expand Down

0 comments on commit 09fd79e

Please sign in to comment.