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: support auto URLs in _sanitize_web3_url() helper func #1952

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

mikeshultz
Copy link
Member

@mikeshultz mikeshultz commented Mar 6, 2024

What I did

Fixes an issue caused by the host: auto setting in ape-hardhat's config.

Traceback (most recent call last):
  File "/home/mike/dev/ape/src/ape/logging.py", line 102, in emit
    msg = handler(msg)
          ^^^^^^^^^^^^
  File "/home/mike/dev/ape/src/ape_ethereum/provider.py", line 92, in _sanitize_web3_url
    sanitized_url = sanitize_url(rest[0])
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mike/dev/ape/src/ape/logging.py", line 278, in sanitize_url
    url_obj = URL(url).with_user(None).with_password(None)
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mike/.venvs/ape-dev/lib/python3.11/site-packages/yarl/_url.py", line 838, in with_user
    raise ValueError("user replacement is not allowed for relative URLs")
ValueError: user replacement is not allowed for relative URLs

How I did it

Does not try and sanitize auto URLs

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

@mikeshultz mikeshultz added the category: bug Something isn't working label Mar 6, 2024
@mikeshultz mikeshultz self-assigned this Mar 6, 2024
@mikeshultz mikeshultz requested a review from antazoey March 6, 2024 20:23
@mikeshultz mikeshultz enabled auto-merge (squash) March 6, 2024 20:28
@mikeshultz mikeshultz merged commit bc8c9ea into ApeWorX:main Mar 6, 2024
16 checks passed
@mikeshultz mikeshultz deleted the fix/sanitize-url branch March 6, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants