bchavez / bchavez/Pinata.Client

Throw exception on passing MultipartFormDataContent in AddPinataFile

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
17
Forks
2
PR merge metrics
No merged PRs in 30d

Description

**Context**

Hi, thanks for your Pinata client first of all.
I needed to upload a directory with files. In `PinFileToIpfsAsync` I've passed `Action` in which I've called `AddPinataFile` only once and passed `MultipartFormDataContent` object in it. Since `MultipartFormDataContent` is a heir of `HttpContent` code worked correctly, but when I opened Pinata I saw, that I've uploaded a file without extension.
I was puzzled until I opened your source code and after that I've replaced one call of `AddPinataFile` passing `MultipartFormDataContent` with foreach and passing `ByteArrayContent`.
It is not intended to use `MultipartFormDataContent` in `AddPinataFile`, so maybe it should be prevented?

![image](https://user-images.githubusercontent.com/46875481/133924278-1cd901e8-0d44-4024-a523-927938c47654.png)

**Alternatives**

Throw `ArgumentException` when user passes `MultipartFormDataContent` object in `AddPinataFile`.

**If the feature request is approved, would you be willing to submit a PR?**

Yes

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.