Skip to content

Commit 995df64

Browse files
committed
Fixed query param behavior
1 parent b4ab31a commit 995df64

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

LinkDotNet.Blog.UnitTests/Web/Shared/UserRecordServiceTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public async Task ShouldNotThrowExceptionToOutsideWorld()
9191

9292
[InlineData("http://localhost/blogPost/12?q=3", "blogPost/12")]
9393
[InlineData("http://localhost/?q=3", "")]
94+
[InlineData("", "")]
95+
[InlineData("http://localhost/someroute/subroute", "someroute/subroute")]
9496
[Theory]
9597
public async Task ShouldRemoveQueryStringIfPresent(string url, string expectedRecord)
9698
{

LinkDotNet.Blog.Web/Shared/UserRecordService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private string GetClickedUrl()
9191
}
9292

9393
var queryIndex = basePath.IndexOf('?');
94-
return queryIndex <= 0 ? basePath[..(queryIndex - 1)] : basePath;
94+
return queryIndex >= 0 ? basePath[..queryIndex] : basePath;
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)