slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.64k stars 1.13k forks source link

fix: create multipart form when multipart request #1117

Closed EkeMinusYou closed 4 weeks ago

EkeMinusYou commented 1 year ago

This PR fixs form parameter format when multipart request.

kanata2 commented 1 year ago

@EkeMinusYou Could you add an explanation of what the problem is with the current implementation, or a link to the issue?

EkeMinusYou commented 1 year ago

@kanata2 It is not clearly described in Slack's API documentation and is difficult to explain.

https://api.slack.com/methods/files.remote.add

However, when I checked the actual behavior, it seems that in the case of mutlipart request, the parameters must be put in the body instead of the query. Otherwise the token cannot be passed and authentication will fail.

samarthkathal commented 3 months ago

Hi @EkeMinusYou @kanata2 , any updates on this?

context:

This worked fine for me when using files.remote.add using postman with same params but failed with slack-go

I was receiving invalid_auth when using AddRemoteFileContext. I had not investigated why this was happening but I did check my bot token and all other attributes.

Seems like this PR should fix that issue.

lorenzoaiello commented 2 months ago

@samarthkathal this PR may be a valid fix for #1295 but I've having some trouble reproducing the issue to understand whether this would fix it. Would you be able to help me reproduce the issue?

jjjjeeffff commented 1 month ago

@samarthkathal this PR may be a valid fix for #1295 but I've having some trouble reproducing the issue to understand whether this would fix it. Would you be able to help me reproduce the issue?

@lorenzoaiello see my comment here to repro: https://github.com/slack-go/slack/issues/1295#issuecomment-2234141986