From 7ffa466e8033f74a90776a477cd29ec02da32798 Mon Sep 17 00:00:00 2001 From: Pranay Valson Date: Tue, 11 Jun 2024 15:35:17 -0700 Subject: [PATCH 1/2] Update dependabot.yml --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bde3af3..1944d7d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,6 +17,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "develop" reviewers: - "noslav" - "rogarcia" From 79083931560ff4787edf9cc022527387288138a9 Mon Sep 17 00:00:00 2001 From: tarassh Date: Thu, 22 Aug 2024 10:19:44 -0700 Subject: [PATCH 2/2] fix --- internal/storage/ipfs.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/internal/storage/ipfs.go b/internal/storage/ipfs.go index 2f0c41a..b5d7b4a 100644 --- a/internal/storage/ipfs.go +++ b/internal/storage/ipfs.go @@ -104,12 +104,19 @@ func (store *ipfsStore) createMultiformWriter(contents []byte) (*bytes.Buffer, s body := &bytes.Buffer{} writer := multipart.NewWriter(body) - if err := writer.WriteField("filedata", string(contents)); err != nil { - return body, "", fmt.Errorf("error writing form field: %w", err) + // Create a new form-data header with the filename and write the file content + part, err := writer.CreateFormFile("file", "specimen") + if err != nil { + return nil, "", fmt.Errorf("error creating form file: %w", err) + } + + if _, err := part.Write(contents); err != nil { + return nil, "", fmt.Errorf("error writing file content: %w", err) } + // Close the multipart writer if err := writer.Close(); err != nil { - log.Error("error closing multipart writer", err) + return nil, "", fmt.Errorf("error closing multipart writer: %w", err) } return body, writer.FormDataContentType(), nil