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 IPFS node address parsing on Git console #725

Merged
merged 4 commits into from
Mar 12, 2024

Conversation

angrybayblade
Copy link

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.

Fixes

If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce to agents-aea?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Lint and unit tests pass locally with my changes and CI passes too
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease.
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Comment on lines +141 to +147
def test_node_addr_cleanup() -> None:
"""Test node address clean up method."""

original_addr = "/dns/to/some/node"
consoled_parsed_addr = f"C:/Git/bin/{original_addr}"
with patch("platform.system", return_value="Windows"):
assert _clean_ipfs_node_url(ipfs_node=consoled_parsed_addr) == original_addr
Copy link
Author

@angrybayblade angrybayblade Mar 12, 2024

Choose a reason for hiding this comment

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

@jmoreira-valory this will take care of the corrupted node strings

Comment on lines +146 to +149
if platform.system() != "Windows":
return ipfs_node
if not ipfs_node.startswith("C:/"):
return ipfs_node
Copy link
Collaborator

@jmoreira-valory jmoreira-valory Mar 12, 2024

Choose a reason for hiding this comment

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

Can you just remove this piece of code? seems the lines below would sanitize it always, even in more general cases, no?

Suggested change
if platform.system() != "Windows":
return ipfs_node
if not ipfs_node.startswith("C:/"):
return ipfs_node

Copy link
Author

Choose a reason for hiding this comment

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

Problem is, this issue is git console and windows specific only. If we don't have this check and sanitise always, we might end up overlooking some other issue. So for now let's keep this specific to one issue.

@angrybayblade angrybayblade merged commit 162e4a8 into main Mar 12, 2024
33 of 36 checks passed
@DavidMinarsch DavidMinarsch deleted the fix/windows-addr-res branch March 24, 2024 16:55
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.

3 participants