Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/Humans.Web/Controllers/ProfileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ await _emailService.SendEmailVerificationAsync(
}
catch (ValidationException ex)
{
_logger.LogWarning(ex, "Failed to add email address for user {UserId}", user.Id);
_logger.LogWarning("Rejected email add for user {UserId}: {Reason}", user.Id, ex.Message);
ModelState.AddModelError(nameof(model.NewEmail), ex.Message);
return View(nameof(Emails), await BuildEmailsViewModelAsync(user));
}
Expand Down Expand Up @@ -971,12 +971,20 @@ public async Task<IActionResult> DownloadData()
[ResponseCache(Duration = 3600, Location = ResponseCacheLocation.Client)]
public async Task<IActionResult> Picture(Guid id, CancellationToken ct)
{
var (data, contentType) = await _profileService.GetProfilePictureAsync(id, ct);
try
{
var (data, contentType) = await _profileService.GetProfilePictureAsync(id, ct);

if (data is null || string.IsNullOrEmpty(contentType))
return NotFound();
if (data is null || string.IsNullOrEmpty(contentType))
return NotFound();

return File(data, contentType);
return File(data, contentType);
}
catch (OperationCanceledException) when (ct.IsCancellationRequested)
{
_logger.LogWarning("Profile picture request for {ProfileId} was cancelled by the client", id);
return StatusCode(499);
}
}

// ─── View Another Profile ────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion src/Humans.Web/Controllers/ShiftAdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public async Task<IActionResult> DeleteShift(string slug, Guid shiftId)
}
catch (InvalidOperationException ex)
{
_logger.LogWarning(ex, "Failed to delete shift {ShiftId} in team {Slug}", shiftId, slug);
_logger.LogWarning("Rejected shift delete for shift {ShiftId} in team {Slug}: {Reason}", shiftId, slug, ex.Message);
SetError(ex.Message);
}

Expand Down
Loading