diff options
author | crupest <crupest@outlook.com> | 2019-04-26 14:04:24 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-26 14:04:24 +0800 |
commit | 2edd421354752f65be8d9974b5b04bb20d1df72c (patch) | |
tree | b98ba8427c006875853263a5236039f42d23140c | |
parent | 214ceda8903bafc28981b58a0530c2a15d7812cc (diff) | |
download | timeline-2edd421354752f65be8d9974b5b04bb20d1df72c.tar.gz timeline-2edd421354752f65be8d9974b5b04bb20d1df72c.tar.bz2 timeline-2edd421354752f65be8d9974b5b04bb20d1df72c.zip |
Test user existence in get avatar.
-rw-r--r-- | Timeline/Controllers/UserController.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs index 1231befb..eaa205de 100644 --- a/Timeline/Controllers/UserController.cs +++ b/Timeline/Controllers/UserController.cs @@ -82,7 +82,10 @@ namespace Timeline.Controllers [HttpGet("user/{username}/avatar"), Authorize] public async Task<IActionResult> GetAvatar([FromRoute] string username) { - // TODO: test user existence. + var existence = (await _userService.GetUser(username)) != null; + if (!existence) + return NotFound(); + var url = await _userService.GetAvatarUrl(username); return Redirect(url); } |