diff options
-rwxr-xr-x | webserver.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/webserver.js b/webserver.js index b53d9ab..4b49412 100755 --- a/webserver.js +++ b/webserver.js @@ -159,7 +159,11 @@ app.get("/.well-known/*", function (req, res) { app.get("/google*.html", function (req, res) { const url = unescape(makeUrlSafe(req, 0)); if (url.match(/^\/google[0-9a-fA-F]*\.html$/)) { - res.sendFile(__dirname + url); + const fname = __dirname + url; + fs.exists(fname, fs.constants.R_OK, err => { + if (err) res.status(400).send("That file does not exist."); + else res.sendFile(fname); + }); } else { res.status(404).send("That file does not exist."); } |