From b4c930ffd0b1e45dcb76a791c4450ca885c0d751 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 19 Dec 2018 15:13:29 -0500 Subject: [PATCH] Use path.join instead of string concat --- server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index eb2de2c..0ca57e1 100644 --- a/server.js +++ b/server.js @@ -25,7 +25,7 @@ const server = http.createServer((req, res) => { case 'playfield.css': case 'editor.css': case 'common.css': - sendFile(res, 'css/' + pathParts[2], 'text/css'); + sendFile(res, path.join('css', pathParts[2]), 'text/css'); break; default: send404(res, uri); @@ -36,7 +36,7 @@ const server = http.createServer((req, res) => { case 'playfield.js': case 'editor.js': case 'interact.js': - sendFile(res, 'js/' + pathParts[2], 'application/javascript'); + sendFile(res, path.join('js', pathParts[2]), 'application/javascript'); break; default: send404(res, uri); @@ -52,7 +52,7 @@ const server = http.createServer((req, res) => { case "environment/input.json": case "hero/input.json": case "villain/input.json": - sendFile(res, "template/" + item, 'application/json'); + sendFile(res, path.join("template", item), 'application/json'); break; case "environment/deck.svg": case "hero/deck.svg": @@ -61,7 +61,7 @@ const server = http.createServer((req, res) => { case "villain/deck.svg": case "villain/character.svg": case "villain/instructions.svg": - sendFile(res, "template/" + item, 'image/svg+xml'); + sendFile(res, path.join("template", item), 'image/svg+xml'); break; default: send404(res, uri);