diff --git a/LNURL.Tests/UnitTest1.cs b/LNURL.Tests/UnitTest1.cs index 9271376..c6e4725 100644 --- a/LNURL.Tests/UnitTest1.cs +++ b/LNURL.Tests/UnitTest1.cs @@ -49,7 +49,9 @@ public void CanHandlePayLinkEdgeCase() [Theory] [InlineData("kukks@btcpay.kukks.org", "https://btcpay.kukks.org/.well-known/lnurlp/kukks")] - [InlineData("kukks@tor.onion", "http://tor.onion/.well-known/lnurlp/kukks")] + [InlineData("kukks@btcpay.kukks.org:4000", "https://btcpay.kukks.org:4000/.well-known/lnurlp/kukks")] + [InlineData("kukks@tor.onion","http://tor.onion/.well-known/lnurlp/kukks")] + [InlineData("kukks@tor.onion:4000","http://tor.onion:4000/.well-known/lnurlp/kukks")] public void CanParseLightningAddress(string lightningAddress, string expectedUrl) { Assert.Equal(expectedUrl, LNURL.ExtractUriFromInternetIdentifier(lightningAddress).ToString()); diff --git a/LNURL/LNURL.cs b/LNURL/LNURL.cs index aded405..a78ceb6 100644 --- a/LNURL/LNURL.cs +++ b/LNURL/LNURL.cs @@ -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]}"