aboutsummaryrefslogtreecommitdiff
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
commit79f5053b3a2140a2633b2b0a88fb95d5594267ec (patch)
treeb98ba8427c006875853263a5236039f42d23140c
parent1affca9259fc3178595e4dfdf2389977110c8f74 (diff)
downloadtimeline-79f5053b3a2140a2633b2b0a88fb95d5594267ec.tar.gz
timeline-79f5053b3a2140a2633b2b0a88fb95d5594267ec.tar.bz2
timeline-79f5053b3a2140a2633b2b0a88fb95d5594267ec.zip
Test user existence in get avatar.
-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);
}