From 41c8ccfee711255cbc06c69641b9a9c4553ee219 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Wed, 3 Apr 2019 20:53:10 +0200 Subject: [PATCH] [1.1.6] rename functions and make SendFileResponse with a parameter for the folder (default resources), also put returntype boolean, add function that parse post params, if path is a dictionary try to load index.html --- Bot-Utils/Properties/AssemblyInfo.cs | 2 +- Bot-Utils/Webserver.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Bot-Utils/Properties/AssemblyInfo.cs b/Bot-Utils/Properties/AssemblyInfo.cs index afcd53c..a85c4d0 100644 --- a/Bot-Utils/Properties/AssemblyInfo.cs +++ b/Bot-Utils/Properties/AssemblyInfo.cs @@ -42,5 +42,5 @@ using System.Runtime.InteropServices; * 1.1.3 Variables parsing now as a String * 1.1.4 add Woff as Binary type * 1.1.5 add a function to send an object as json directly - * 1.1.6 rename functions and make SendFileResponse with a parameter for the folder + * 1.1.6 rename functions and make SendFileResponse with a parameter for the folder, */ diff --git a/Bot-Utils/Webserver.cs b/Bot-Utils/Webserver.cs index 8208b32..eccf400 100644 --- a/Bot-Utils/Webserver.cs +++ b/Bot-Utils/Webserver.cs @@ -48,8 +48,8 @@ namespace BlubbFish.Utils.IoT.Bots { } else { restr = restr.Substring(1); } - if(restr == "") { - restr = "index.html"; + if(Directory.Exists(folder + "/" + restr)) { + restr += "/index.html"; } String end = restr.IndexOf('.') != -1 ? restr.Substring(restr.IndexOf('.') + 1) : ""; if(File.Exists(folder + "/" + restr)) {