Skip to content

Return proper error for empty address#427

Open
chenyukang wants to merge 1 commit intonervosnetwork:masterfrom
chenyukang:yukang-fix-multiaddr
Open

Return proper error for empty address#427
chenyukang wants to merge 1 commit intonervosnetwork:masterfrom
chenyukang:yukang-fix-multiaddr

Conversation

@chenyukang
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes parsing of empty or whitespace-only multiaddr strings to properly return an error instead of creating an invalid empty Multiaddr. The issue was triggered by fnn-cli connect_peer --address "" which should return an error.

Changes:

  • Added a check in Multiaddr::from_str to return Error::InvalidMultiaddr when parsing produces no protocol bytes
  • Added test coverage for empty (""), whitespace (" "), and slash-only ("/") inputs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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