File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -63,15 +63,13 @@ const createServer = (domain = "localhost") => {
6363 app . use ( express . static ( staticPath ) )
6464 // redirect 404 to 404.html or to index.html
6565 app . use ( ( req , res ) => {
66- if ( ! staticPath . startsWith ( "/" ) )
67- staticPath = process . cwd ( ) + "/" + staticPath
6866 const p404 = staticPath + "/404.html"
6967 const index = staticPath + "/index.html"
7068 // istanbul ignore else: not interesting
7169 if ( fs . existsSync ( p404 ) )
72- res . status ( 404 ) . sendFile ( p404 )
70+ res . status ( 404 ) . sendFile ( path . resolve ( p404 ) )
7371 else if ( fs . existsSync ( index ) )
74- res . status ( 404 ) . sendFile ( index )
72+ res . status ( 404 ) . sendFile ( path . resolve ( index ) )
7573 else res . status ( 404 ) . send ( req . path + " not found." )
7674 } )
7775 console . info ( "Serving static path: " + staticPath )
You can’t perform that action at this time.
0 commit comments