Dont check contentType before we know if the url is provided

This commit is contained in:
Dominic Villemure
2024-07-10 01:56:06 -04:00
parent df55125c48
commit 9a884d78b6
3 changed files with 6 additions and 6 deletions

View File

@@ -18,8 +18,6 @@ public class UploadBannerPictureCommandHandler(IHttpContextAccessor contextAcces
{
public async Task<IResult> 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();

View File

@@ -18,8 +18,6 @@ public class UploadProfilePictureCommandHandler(IHttpContextAccessor contextAcce
{
public async Task<IResult> 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();

View File

@@ -19,8 +19,6 @@ public class UploadWebsiteIconCommandHandler(IHttpContextAccessor contextAccesso
{
public async Task<IResult> 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();