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

Fix duplicate slashes in url #505

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

anthonyburdi
Copy link
Member

@anthonyburdi anthonyburdi commented Oct 22, 2024

We are getting errors due to duplicate slashes in urls e.g. this error.

This PR is intended to make the agent more resilient when constructing urls. In the future we can also consider using a url object instead of strings, and then construct the string when needed.

@anthonyburdi anthonyburdi self-assigned this Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.03%. Comparing base (468c5d5) to head (a4b7f12).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #505      +/-   ##
==========================================
+ Coverage   87.96%   88.03%   +0.06%     
==========================================
  Files          24       24              
  Lines        1030     1036       +6     
==========================================
+ Hits          906      912       +6     
  Misses        124      124              
Flag Coverage Δ
3.10 74.13% <76.92%> (+0.15%) ⬆️
3.11 74.13% <76.92%> (+0.15%) ⬆️
3.9 73.98% <76.92%> (+0.15%) ⬆️
integration 71.13% <84.61%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@anthonyburdi anthonyburdi changed the title B/ /zelda 1060/fix duplicate slashes in url Fix duplicate slashes in url Oct 23, 2024
@anthonyburdi anthonyburdi marked this pull request as ready for review October 23, 2024 00:46
Copy link
Contributor

@Shinnnyshinshin Shinnnyshinshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks awesome. super clear, well tested. Thanks so much for doing this @anthonyburdi

def test_construct_url_from_base_plus_path(base: str, path: str, expected_url: str):
"""Test that urljoin constructs all combinations of urls correctly."""
constructed_url = urljoin(base, path)
assert constructed_url == expected_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to test urljoin itself

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right - I wrote this test when I had a custom fn. Will clean it up.

Copy link
Contributor

@rreinoldsc rreinoldsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants