summaryrefslogtreecommitdiff
path: root/main.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/main.go b/main.go
index 5735e19..f3c1196 100644
--- a/main.go
+++ b/main.go
@@ -165,11 +165,11 @@ func main() {
var inputMetadata *input.MetadataStruct
id := inputClient.ID(file)
+ cacheMapMutex.Lock()
if _, ok := cacheMap[id]; !ok {
- cacheMapMutex.Lock()
cacheMap[id] = make(map[uint32]struct{})
- cacheMapMutex.Unlock()
}
+ cacheMapMutex.Unlock()
convertersToLaunch := []int{}
for j, conv := range converters {
@@ -239,10 +239,14 @@ func main() {
return
}
- fileContent := make([]byte, inputMetadata.Size)
- if _, err = reader.Read(fileContent); err != nil {
+ fileContent, err := io.ReadAll(reader)
+ if err != nil {
fileLogger.Warn("fail to read content of input file", slog.String("error", err.Error()))
return
+ } else if int64(len(fileContent)) != inputMetadata.Size {
+ fileLogger.Warn("the downloaded file seems to be missing some of its content",
+ slog.Int("actual_size_bytes", len(fileContent)),
+ slog.Int64("expected_size_bytes", inputMetadata.Size))
}
reader.Close()