From 526788532153b8d4d7e7724f5010a553a75193ba Mon Sep 17 00:00:00 2001 From: JarcauCristian Date: Tue, 16 Apr 2024 13:06:37 +0100 Subject: [PATCH] changed a bug --- Dockerfile | 2 +- main.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 687ee64..a178e9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN go mod download COPY configs ./configs -RUN curl https://dl.min.io/client/mc/release/linux-amd64/mc -o mc +RUN curl https://dl.min.io/client/mc/release/linux-arm64/mc -o mc RUN chmod +x ./mc diff --git a/main.go b/main.go index b6400d6..855dea5 100644 --- a/main.go +++ b/main.go @@ -483,16 +483,20 @@ func main() { reader := bytes.NewReader(buf.Bytes()) - result, err := minio.uploadFile(reader, mapTags, float64(fileSize), fileName, contentType, boolTemporary) + results, err := minio.uploadFile(reader, mapTags, float64(fileSize), fileName, contentType, boolTemporary) if err != nil { c.JSON(500, gin.H{ "message": "Something happened when trying to upload the file!", }) } else { - c.JSON(201, gin.H{ - "message": result, - }) + if len(results) == 0 { + c.JSON(404, gin.H{ + "message": "Could not upload the file in any of the instances!", + }) + } else { + c.JSON(201, results) + } } } }