Skip to content

Commit

Permalink
Merge pull request #7 from jbojcic1/fix/ExtractUriFromInternetIdentif…
Browse files Browse the repository at this point in the history
…ier-bug

Fix ExtractUriFromInternetIdentifier bug
  • Loading branch information
Kukks authored Jun 28, 2024
2 parents 061bcaa + 3f08523 commit 5b9c97b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion LNURL.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public void CanHandlePayLinkEdgeCase()

[Theory]
[InlineData("[email protected]", "https://btcpay.kukks.org/.well-known/lnurlp/kukks")]
[InlineData("[email protected]", "http://tor.onion/.well-known/lnurlp/kukks")]
[InlineData("[email protected]:4000", "https://btcpay.kukks.org:4000/.well-known/lnurlp/kukks")]
[InlineData("[email protected]","http://tor.onion/.well-known/lnurlp/kukks")]
[InlineData("[email protected]:4000","http://tor.onion:4000/.well-known/lnurlp/kukks")]
public void CanParseLightningAddress(string lightningAddress, string expectedUrl)
{
Assert.Equal(expectedUrl, LNURL.ExtractUriFromInternetIdentifier(lightningAddress).ToString());
Expand Down
2 changes: 1 addition & 1 deletion LNURL/LNURL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static Uri ExtractUriFromInternetIdentifier(string identifier)
UriBuilder uriBuilder;
if (s2.Length > 1)
uriBuilder = new UriBuilder(
s[1].EndsWith(".onion", StringComparison.InvariantCultureIgnoreCase) ? "http" : "https",
s2[0].EndsWith(".onion", StringComparison.InvariantCultureIgnoreCase) ? "http" : "https",
s2[0], int.Parse(s2[1]))
{
Path = $"/.well-known/lnurlp/{s[0]}"
Expand Down

0 comments on commit 5b9c97b

Please sign in to comment.