Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Feb 25, 2024
1 parent 8fcd90e commit 688231e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ private string GenerateFileId(CancellationToken ct)
{
var fileIds = _hexGenerator.GetHex(count, 3);
var existing = _dbContext.IdEntities.Select(x => x.FileId).Where(x => fileIds.Contains(x)).ToHashSet();
if (existing.Count == count) continue;
if (existing.Count == fileIds.Count) continue;
if (existing.Count == 0) return fileIds.First();
return existing.First(x => !fileIds.Contains(x));
if (existing.FirstOrDefault(x => !fileIds.Contains(x)) is not { } freeFileId) continue;
return freeFileId;
}
return fileId;
}
Expand Down

0 comments on commit 688231e

Please sign in to comment.