From c1d5ab3468cbff5bee16a69946fb17908c1f4679 Mon Sep 17 00:00:00 2001 From: Kamil Tunkiewicz Date: Fri, 16 Oct 2020 19:44:30 +0200 Subject: [PATCH] correct path matching --- cli/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/index.ts b/cli/index.ts index 814cb9ad..91c8e80d 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -204,7 +204,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) { } else { const filePath = normalize(join(dirname(pathToSpec), request.url || '')); const relativePath = relative(dirname(pathToSpec), filePath); - if (options.static && options.static !== '' && relativePath.startsWith(options.static)) { + if (options.static && options.static !== '' && relativePath.startsWith(options.static + '/')) { const file = createReadStream(filePath); file.on('open', function () { response.setHeader('Content-Type', lookup(filePath) || 'text/plain');