Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BrowseRouter/Infrastructure/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("BrowserRouter.Tests")]
[assembly: InternalsVisibleTo("BrowseRouter.Tests")]
6 changes: 4 additions & 2 deletions BrowseRouter/Model/UriFactory.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
namespace BrowseRouter.Model;
using System.Net;

namespace BrowseRouter.Model;

public static class UriFactory
{
public static Uri Get(string url)
{
try
{
return new Uri(url);
return new Uri(WebUtility.UrlDecode(url));
}
catch (UriFormatException)
{
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>0.15.2</Version>
<Version>0.15.3</Version>
<Product>BrowseRouter</Product>
<Copyright>EnduraByte LLC 2025</Copyright>
<!-- Reduces flagging as malware -->
Expand Down
33 changes: 33 additions & 0 deletions Tests/BrowseRouter.Tests/Model/UriFactoryTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using BrowseRouter.Model;

namespace BrowseRouter.Tests.Model;

public class GetMethod
{
[Fact]
public void HandlesValidUrl()
{
string url = "https://www.example.com/path";
var act = () => UriFactory.Get(url);

act.Should().NotThrow<UriFormatException>();
}

[Fact]
public void HandlesUrlWithoutHttps()
{
string url = "www.example.com/path";
var act = () => UriFactory.Get(url);

act.Should().NotThrow<UriFormatException>();
}

[Fact]
public void HandlesUrlEncodedUrl()
{
string url = "https%3A%2F%2Fwww.example.com%2Fpath%2F";
var act = () => UriFactory.Get(url);

act.Should().NotThrow<UriFormatException>();
}
}