diff --git a/src/Application/Users/Commands/UploadBannerPicture.cs b/src/Application/Users/Commands/UploadBannerPicture.cs index 3bab003..be7590f 100644 --- a/src/Application/Users/Commands/UploadBannerPicture.cs +++ b/src/Application/Users/Commands/UploadBannerPicture.cs @@ -18,8 +18,6 @@ public class UploadBannerPictureCommandHandler(IHttpContextAccessor contextAcces { public async Task Handle(UploadBannerPictureCommand request, CancellationToken cancellationToken) { - var contentType = contextAccessor.EnsureContentType(); - // If an url to the picture is provided, use it right away and don't upload anything. if (!string.IsNullOrEmpty(request.BannerPictureUrl)) { @@ -27,6 +25,8 @@ public class UploadBannerPictureCommandHandler(IHttpContextAccessor contextAcces return Results.Ok(request.BannerPictureUrl); } + var contentType = contextAccessor.EnsureContentType(); + var identityUser = await identityService.GetCurrentUserAsync(); var currentUserId = new Guid(identityUser?.Id ?? "").ToString(); diff --git a/src/Application/Users/Commands/UploadProfilePicture.cs b/src/Application/Users/Commands/UploadProfilePicture.cs index 0dbb394..2e017d2 100644 --- a/src/Application/Users/Commands/UploadProfilePicture.cs +++ b/src/Application/Users/Commands/UploadProfilePicture.cs @@ -18,8 +18,6 @@ public class UploadProfilePictureCommandHandler(IHttpContextAccessor contextAcce { public async Task Handle(UploadProfilePictureCommand request, CancellationToken cancellationToken) { - var contentType = contextAccessor.EnsureContentType(); - // If an url to the picture is provided, use it right away and don't upload anything. if (!string.IsNullOrEmpty(request.ProfilePictureUrl)) { @@ -27,6 +25,8 @@ public class UploadProfilePictureCommandHandler(IHttpContextAccessor contextAcce return Results.Ok(request.ProfilePictureUrl); } + var contentType = contextAccessor.EnsureContentType(); + var identityUser = await identityService.GetCurrentUserAsync(); var currentUserId = new Guid(identityUser?.Id ?? "").ToString(); diff --git a/src/Application/Users/Commands/UploadWebsiteIcon.cs b/src/Application/Users/Commands/UploadWebsiteIcon.cs index 29158b2..eaa8cd6 100644 --- a/src/Application/Users/Commands/UploadWebsiteIcon.cs +++ b/src/Application/Users/Commands/UploadWebsiteIcon.cs @@ -19,8 +19,6 @@ public class UploadWebsiteIconCommandHandler(IHttpContextAccessor contextAccesso { public async Task Handle(UploadWebsiteIconCommand request, CancellationToken cancellationToken) { - var contentType = contextAccessor.EnsureContentType(); - // If an url to the picture is provided, use it right away and don't upload anything. if (!string.IsNullOrEmpty(request.WebsitePictureUrl)) { @@ -28,6 +26,8 @@ public class UploadWebsiteIconCommandHandler(IHttpContextAccessor contextAccesso return Results.Ok(request.WebsitePictureUrl); } + var contentType = contextAccessor.EnsureContentType(); + var identityUser = await identityService.GetCurrentUserAsync(); var currentUserId = new Guid(identityUser?.Id ?? "").ToString();