Slackdiff: Make Slack file upload respect a configured HTTP proxy#3587
Merged
robertcheramy merged 2 commits intoytti:masterfrom Aug 1, 2025
Merged
Slackdiff: Make Slack file upload respect a configured HTTP proxy#3587robertcheramy merged 2 commits intoytti:masterfrom
robertcheramy merged 2 commits intoytti:masterfrom
Conversation
0414d0e to
9166799
Compare
Contributor
Author
|
Fixed a bad rebase(?) |
Specifying a channel where the bot/app is not a member would cause a Slack::Web::Api::Errors::NotInChannel error when attempting to post the file. In case the bot token has been granted the channels:join oauth scope and the target channel is joinable, making the bot join automatically will make usage easier.
The new slack file upload API introduced by commit b92e620 to replace the deprecated API which was not available to new users (see issue ytti#3189) introduced a new HTTP call that was not using the provided proxy configuration and broke environments where a proxy was necessary. This commit fixes the regression reported in the issue ytti#3534 by using the same proxy setting for the new HTTP POST request to https://files.slack.com
9166799 to
4a99c2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-Request Checklist
rubocop --auto-correct)rake test)Description
The new slack file upload API introduced by commit b92e620 to replace the deprecated API which was not available to new users (see issue #3189) introduced a new HTTP call that was not using the provided proxy configuration and broke environments where a proxy was necessary.
This commit fixes the regression reported in the issue #3534 by using the same proxy setting for the new HTTP POST request to
https://files.slack.com/Closes issue #3534
A minor related change:
I was unable to figure out why the slack app I created in a sandbox workspace did not show up in the list of apps I could invite into a channel, so in order to actually get the bot to post anything to the channel, I made the bot attempt to automatically join the channel if an upload fails due to the bot not being in the channel. I can split that into a separate PR, but since it is a minor change, I hope this will be good enough.
Testing
Three scenarios have been tested with a dummy device, a git output and a sandbox slack organization:
No proxy
No regresssions are visible when testing without a proxy in the config:
With a proxy
Before the change it could be seen from proxy logs that three HTTP requests were made through the proxy:
After the change four requests are seen:
And the request succeeds:
Bot not in channel
If the bot is not in the channel, the bot will attempt to join the channel and retry the request:
Causing 2 extra requests: