Add support for uploading files from memory + bug fixes#168
Conversation
|
|
Can you separate the bug fixes into different pull request? |
|
Hello, are you there, I would be happy to accept bug fixes. However I want to consider the new feature separately. |
|
Not got around to it yet. It'll try to sort it out soon. |
|
I've added a number of you bug fixes, please fix the merge conflicts |
|
@yourWaifu the only merge conflict is the version of CPR I use (since I had to use a custom one to fix an upload bug), they recently merged a fix for that, but it looks like the version you use is still before that. I'll try switching the new official version soon & make sure that works (this branch is kind of changes for my bot -- not a super neat PR). It currently has these changes:
|
|
I can't merge when there are merge conflicts, maybe try doing a git rebase. |
|
@yourWaifu I fixed it for you. I'm leaving the CPR version as you had it as I've yet to try the new version & don't want to link to my fork here. Though I suggest you look into updating it soon. |
|
I have updated cpr, I took a look at supporting buffer uploads but I found a problem. You Discord expects a filename if you want to attach it to an embed. CPR doesn't look like it has a way to set the filename of a buffer that I know of. |
|
oops nevermind my last statement about buffers and filenames, I didn't look at the libcurl docs hard enough |
|
You don't have to do it in libcurl, |
|
(the constructor of cpr::Buffer changed a bit since this PR, the name now has to be a std::string like: |
This PR allows for uploading files directly from memory (a feature I needed).
Note!
This PR changes the cpr repo to https://github.com/MacDue/cpr !
This is due to a bug with cpr where uploading files larger than 16,000bytes would corrupt the file -- which I repaired in my fork. Issue described here: libcpr/cpr#342