bchavez / Pinata.Client

:floppy_disk: A simple .NET/C# client for Pinata and IPFS. https://pinata.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throw exception on passing MultipartFormDataContent in AddPinataFile

GorgeousPuree opened this issue · comments

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

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