RickStrahl / Westwind.AspNetCore

ASP.NET Core Helpers and Utilities
MIT License
126 stars 25 forks source link

Markdown now requires trailing slash for subsite #8

Closed jjestrellaa closed 5 years ago

jjestrellaa commented 5 years ago

I have a subsite under my domain and now when I try to navigate to its landing page I get this error:

An unhandled exception has occurred while executing the request. System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. Parameter name: startIndex at System.String.Substring(Int32 startIndex, Int32 length) at Westwind.AspNetCore.Markdown.MarkdownPageProcessorMiddleware.InvokeAsync(HttpContext context) at Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)

If I add a trailing slash then the page works correctly.

https://myweb.com/subsite - doesn't work https://myweb.com/subsite/ - this works (hits the home controller and displays the index page)

Any clues?

Thanks.

jjestrellaa commented 5 years ago

Of course it had to be a simple fix:

Moved app.UseMarkdown(); just above app.UseMvc instead of above other middleware