dotnet / WatsonWebserver

Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
MIT License
403 stars 83 forks source link

Add URL encoding support and index.html automatic mapping support in ContentRouteHandler #128

Closed ChZhongPengCheng33 closed 9 months ago

ChZhongPengCheng33 commented 9 months ago

Add the following code after here:

if (filePath.EndsWith("/"))
{
    filePath += "index.html";
}
filePath = WebUtility.UrlDecode(filePath);

After adding the above code, my Vitespress documentation website can now function properly.

jchristn commented 9 months ago

Hi @ChZhongPengCheng33 thank you for the PR! I'll be adding another settings parameter to specify the default files for root directory URLs; the default will be "index.html" but it will be a list that will be processed. Thus, I'll be closing this PR. The functionality should be included in the next release!

jchristn commented 9 months ago

Updated to v6.1.5 in NuGet with this functionality. Please refer to the Webserver.Routes.[PreAuthentication|PostAuthentication].Content.DefaultFiles property (List<string>).

It's currently set, by default, to:

        private List<string> _DefaultFiles = new List<string>
        {
            "index.html",
            "index.html",
            "default.html",
            "default.htm",
            "home.html",
            "home.htm",
            "home.cgi",
            "welcome.html",
            "welcome.htm",
            "index.php",
            "default.aspx",
            "default.asp"
        };