From fffe769ccfd38d33455521de83588025d777c6aa Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 28 Mar 2024 21:47:48 -0400 Subject: [PATCH] fix: use mapKey as a string --- protocols/s5/tus.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/protocols/s5/tus.go b/protocols/s5/tus.go index 61457a7..8ead0bc 100644 --- a/protocols/s5/tus.go +++ b/protocols/s5/tus.go @@ -496,11 +496,12 @@ func (t *TusHandler) worker() { mapKey := append([]byte{}, decodedHash.HashBytes()...) mapKey = append(mapKey, []byte(info.Upload.ID)...) - if _, ok := t.uploadMutexMap.Load(mapKey); !ok { - t.uploadMutexMap.Store(mapKey, &sync.Mutex{}) + mapKeyStr := string(mapKey) + if _, ok := t.uploadMutexMap.Load(mapKeyStr); !ok { + t.uploadMutexMap.Store(mapKeyStr, &sync.Mutex{}) } - mutex, _ := t.uploadMutexMap.Load(mapKey) + mutex, _ := t.uploadMutexMap.Load(mapKeyStr) mutex.(*sync.Mutex).Lock() exists, _ := t.UploadExists(ctx, decodedHash.HashBytes())