Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable to upload file without channel param #1286

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions files.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ func (api *Client) completeUploadExternal(ctx context.Context, fileID string, pa
values := url.Values{
"token": {api.token},
"files": {string(requestBytes)},
"channel_id": {params.channel},
}
if params.channel != "" {
values.Add("channels", params.channel)
}

if params.initialComment != "" {
Expand Down Expand Up @@ -556,9 +558,9 @@ func (api *Client) UploadFileV2Context(ctx context.Context, params UploadFileV2P
if params.FileSize == 0 {
return nil, fmt.Errorf("file.upload.v2: file size cannot be 0")
}
if params.Channel == "" {
return nil, fmt.Errorf("file.upload.v2: channel cannot be empty")
}
// if params.Channel == "" {
// return nil, fmt.Errorf("file.upload.v2: channel cannot be empty")
// }
u, err := api.getUploadURLExternal(ctx, getUploadURLExternalParameters{
altText: params.AltTxt,
fileName: params.Filename,
Expand Down