File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,20 @@ import path from "node:path";
44// Import Internal Dependencies
55import { buildServer } from "../http-server/index.js" ;
66
7- export async function start ( json = "nsecure-result.json" , options = { } ) {
7+ export async function start (
8+ payloadFileBasename = "nsecure-result.json" ,
9+ options = { }
10+ ) {
811 const port = Number ( options . port ) ;
9- const dataFilePath = path . join ( process . cwd ( ) , json ) ;
12+ const fileExtension = path . extname ( payloadFileBasename ) ;
13+ if ( fileExtension !== ".json" && fileExtension !== "" ) {
14+ throw new Error ( "You must provide a JSON file (scanner payload) to open" ) ;
15+ }
16+
17+ const dataFilePath = path . join (
18+ process . cwd ( ) ,
19+ fileExtension === "" ? `${ payloadFileBasename } .json` : payloadFileBasename
20+ ) ;
1021
1122 const httpServer = buildServer ( dataFilePath , {
1223 port : Number . isNaN ( port ) ? 0 : port
You can’t perform that action at this time.
0 commit comments