Fix bug when fetching page other than / or /api/*

This commit is contained in:
Michael Nolan 2022-03-31 05:36:41 -05:00
parent 6456ea4524
commit 7826ab4ad6
6 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True"> <Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True">
<MonoDevelop.Ide.Workbench ActiveDocument="../../../../usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets"> <MonoDevelop.Ide.Workbench ActiveDocument="TYTD.Api/Server/Models/InfoType.cs">
<Files> <Files>
<File FileName="TYTD.Api/Server/Models/InfoType.cs" Line="155" Column="47" /> <File FileName="TYTD.Api/Server/Models/InfoType.cs" Line="171" Column="40" />
<File FileName="TYTD.Api/Server/Functions/Downloader.cs" Line="1141" Column="18" /> <File FileName="TYTD.Api/Server/Functions/Downloader.cs" Line="1141" Column="18" />
<File FileName="TYTD.Api/Server/Models/SavedMedia.cs" Line="1" Column="1" /> <File FileName="TYTD.Api/Server/Models/SavedMedia.cs" Line="1" Column="1" />
<File FileName="TYTD.Api/Server/Models/SavedVideo.cs" Line="8" Column="1" /> <File FileName="TYTD.Api/Server/Models/SavedVideo.cs" Line="8" Column="1" />
@ -24,8 +24,10 @@
<State name="__root__"> <State name="__root__">
<Node name="youtube-downloader" expanded="True"> <Node name="youtube-downloader" expanded="True">
<Node name="TYTD.Api" expanded="True"> <Node name="TYTD.Api" expanded="True">
<Node name="Packages" expanded="True"> <Node name="Server" expanded="True">
<Node name="YoutubeExplode" selected="True" /> <Node name="Models" expanded="True">
<Node name="InfoType.cs" selected="True" />
</Node>
</Node> </Node>
</Node> </Node>
<Node name="youtube-downloader" expanded="True"> <Node name="youtube-downloader" expanded="True">

View File

@ -1730,7 +1730,7 @@ namespace TYTD
public static void RootPath(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void RootPath(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
string p = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0]; string p = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
string path = "WebSite/{p}"; string path = $"WebSite/{p}";
if (Directory.Exists(path)) if (Directory.Exists(path))
{ {
string indexHtml = Path.Combine(path, "index.html"); string indexHtml = Path.Combine(path, "index.html");

Binary file not shown.