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

preventing double slash in the api_url #1596

Closed
wants to merge 1 commit into from

Conversation

HTSagara
Copy link
Contributor

Summary

This pull request addresses issue #1595 by ensuring that URLs generated for Slack API requests are correctly formatted to prevent double slashes (//) cause by the previous PR #1594 . The issue occurs when the base_url ends with a trailing slash (/) and the api_method starts with a leading slash (/). This PR modifies the _get_url function to handle such cases by trimming the trailing slash from the base_url when necessary.

Testing

Run either ./scripts/run_validation.sh or ./scripts/run_unit_tests.sh tests/web/test_web_client.py

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.92%. Comparing base (c82c9a0) to head (17e7739).

Files with missing lines Patch % Lines
slack_sdk/web/internal_utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           issue-#1541    #1596   +/-   ##
============================================
  Coverage        84.92%   84.92%           
============================================
  Files              113      113           
  Lines            12628    12630    +2     
============================================
+ Hits             10724    10726    +2     
  Misses            1904     1904           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@vegeris
Copy link

vegeris commented Nov 19, 2024

We reverted the previous commit just to unblock potential future releases; would you mind pulling in the original changes / fixes for edge cases / test updates into one PR?

@HTSagara
Copy link
Contributor Author

Hi @vegeris , I will do that.

@vegeris
Copy link

vegeris commented Nov 20, 2024

Closing this PR as the change will be covered in #1598

@vegeris vegeris closed this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants