diff --git a/DysonNetwork.Sphere/Account/AccountService.cs b/DysonNetwork.Sphere/Account/AccountService.cs index 74c7b48..76529c3 100644 --- a/DysonNetwork.Sphere/Account/AccountService.cs +++ b/DysonNetwork.Sphere/Account/AccountService.cs @@ -51,13 +51,14 @@ public class AccountService( } /// Maintenance methods for server administrator - public async Task EnsureAccountProfileCreated() { var accountsId = await db.Accounts.Select(a => a.Id).ToListAsync(); - var existingId = await db.AccountProfiles.Select(p => p.AccountId).ToListAsync(); - var missingId = accountsId.Except(existingId).ToList(); - + var missingId = await db.AccountProfiles + .Where(p => !accountsId.Contains(p.AccountId)) + .Select(p => p.AccountId) + .ToListAsync(); + if (missingId.Count != 0) { var newProfiles = missingId.Select(id => new Profile { AccountId = id }).ToList(); diff --git a/DysonNetwork.Sphere/Storage/FileController.cs b/DysonNetwork.Sphere/Storage/FileController.cs index 91f15ba..6b45ebc 100644 --- a/DysonNetwork.Sphere/Storage/FileController.cs +++ b/DysonNetwork.Sphere/Storage/FileController.cs @@ -20,7 +20,7 @@ public class FileController( var file = await fs.GetFileAsync(id); if (file is null) return NotFound(); - if (file.StorageUrl is not null) return Redirect(file.StorageUrl); + if (!string.IsNullOrWhiteSpace(file.StorageUrl)) return Redirect(file.StorageUrl); if (file.UploadedTo is null) {