Solving a bug with the account update method

This commit is contained in:
Zoe Roux 2020-03-16 02:23:48 +01:00
parent eb132c2da2
commit eb37ec7d1b
2 changed files with 8 additions and 5 deletions

View File

@ -31,11 +31,11 @@ namespace Kyoo.Api
public class AccountData
{
[FromQuery(Name = "email")]
[FromForm(Name = "email")]
public string Email { get; set; }
[FromQuery(Name = "username")]
[FromForm(Name = "username")]
public string Username { get; set; }
[FromQuery(Name = "picture")]
[FromForm(Name = "picture")]
public IFormFile Picture { get; set; }
}
@ -116,7 +116,10 @@ namespace Kyoo.Api
User user = await _userManager.FindByNameAsync(username);
if (user == null)
return BadRequest();
return new PhysicalFileResult(Path.Combine(_picturePath, user.Id), "image/png");
string path = Path.Combine(_picturePath, user.Id);
if (!System.IO.File.Exists(path))
return NotFound();
return new PhysicalFileResult(path, "image");
}
[HttpPost("update")]

@ -1 +1 @@
Subproject commit 044132d4bf052f61c99186258e9aaf6da571b4ca
Subproject commit 54f9406c079894648b9a84a63aa7944c8d439ce4