fix bug in handleUserFiles

fix not detecting file, as originalUrl has no "/"
This commit is contained in:
Mystikfluu 2023-07-05 11:27:27 +02:00
parent 503b546470
commit a2ef9e0e9f

View File

@ -120,8 +120,8 @@ export const setup = function (router, con, server) {
|| request.originalUrl.split("?").shift(); //backup in case anything goes wrong || request.originalUrl.split("?").shift(); //backup in case anything goes wrong
let path = "" let path = ""
if (existsSync(dir + "views" + originalUrl)) { if (existsSync(dir + "views/" + originalUrl)) {
path = dir + "views" + originalUrl path = dir + "views/" + originalUrl
//send .txt files as plaintext to help browsers interpret it correctly //send .txt files as plaintext to help browsers interpret it correctly
if(originalUrl.endsWith(".txt")) { if(originalUrl.endsWith(".txt")) {
response.set('Content-Type', 'text/plain'); response.set('Content-Type', 'text/plain');