Skip to content

Commit

Permalink
Fix security vulnerability and use ConcurrentDictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
pacna committed Jan 23, 2024
1 parent 0d5933b commit 8f08212
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 184 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Concurrent;
using Edge.MyMusic.Repositories.Models;
using Edge.MyMusic.Repositories.Models.Documents;
using Edge.MyMusic.Services.Models;
Expand All @@ -16,7 +17,7 @@ static MusicInMemoryRepository()
string musicId2 = "mid2";
string musicId3 = "mid3";

_datastore = new Dictionary<string, MusicDocument>();
_datastore = new ConcurrentDictionary<string, MusicDocument>();

_datastore.TryAdd(musicId1, new MusicDocument
{
Expand Down Expand Up @@ -134,7 +135,6 @@ public Task<MusicDocument> AddMusicAsync(MusicDocument doc)
public Task DeleteMusicAsync(string id)
{
_datastore.Remove(id);

return Task.CompletedTask;
}

Expand Down
Loading

0 comments on commit 8f08212

Please sign in to comment.