aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-26 14:04:24 +0800
committercrupest <crupest@outlook.com>2019-04-26 14:04:24 +0800
commit2edd421354752f65be8d9974b5b04bb20d1df72c (patch)
treeb98ba8427c006875853263a5236039f42d23140c /Timeline/Controllers/UserController.cs
parent214ceda8903bafc28981b58a0530c2a15d7812cc (diff)
downloadtimeline-2edd421354752f65be8d9974b5b04bb20d1df72c.tar.gz
timeline-2edd421354752f65be8d9974b5b04bb20d1df72c.tar.bz2
timeline-2edd421354752f65be8d9974b5b04bb20d1df72c.zip
Test user existence in get avatar.
Diffstat (limited to 'Timeline/Controllers/UserController.cs')
-rw-r--r--Timeline/Controllers/UserController.cs5
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);
}