@@ -180,14 +180,14 @@ async function run(
180180 const reqId = req . requestId ;
181181 let reqPath = req . path . substring ( 1 ) ;
182182
183- console . log ( `XREQPATH ${ reqPath } ` )
184- console . log ( req )
183+ console . log ( `XREQPATH ${ reqPath } ` ) ;
184+ console . log ( req ) ;
185185
186186 if ( ! reqPath || ( reqPath . endsWith ( "/" ) && reqPath . length === 1 ) ) {
187187 reqPath = getRelativePath ( ) ;
188188 }
189189
190- console . log ( `XREQPATH1 ${ reqPath } ` )
190+ console . log ( `XREQPATH1 ${ reqPath } ` ) ;
191191
192192 const ext = Url . extname ( reqPath ) ;
193193 let url = null ;
@@ -263,38 +263,43 @@ async function run(
263263 const projectFolder = addedFolder [ 0 ] ;
264264 const query = url . split ( "?" ) [ 1 ] ;
265265 let rootFolder = "" ;
266-
267- if ( projectFolder !== undefined && pathName . includes ( projectFolder . url ) ) {
268- rootFolder = projectFolder . url ;
266+
267+ if (
268+ projectFolder !== undefined &&
269+ pathName . includes ( projectFolder . url )
270+ ) {
271+ rootFolder = projectFolder . url ;
269272 } else {
270- rootFolder = pathName ;
273+ rootFolder = pathName ;
271274 }
272-
273- if ( ( rootFolder . startsWith ( "ftp:" ) || rootFolder . startsWith ( "sftp:" ) ) && rootFolder . includes ( "?" ) ) {
274- rootFolder = rootFolder . split ( "?" ) [ 0 ] ;
275+
276+ if (
277+ ( rootFolder . startsWith ( "ftp:" ) || rootFolder . startsWith ( "sftp:" ) ) &&
278+ rootFolder . includes ( "?" )
279+ ) {
280+ rootFolder = rootFolder . split ( "?" ) [ 0 ] ;
275281 }
276-
277-
282+
278283 rootFolder = rootFolder . replace ( / \/ + $ / , "" ) ; // remove trailing slash
279- reqPath = reqPath . replace ( / ^ \/ + / , "" ) ; // remove leading slash
280-
284+ reqPath = reqPath . replace ( / ^ \/ + / , "" ) ; // remove leading slash
285+
281286 const rootParts = rootFolder . split ( "/" ) ;
282287 const pathParts = reqPath . split ( "/" ) ;
283-
288+
284289 if ( pathParts [ 0 ] === rootParts [ rootParts . length - 1 ] ) {
285- pathParts . shift ( ) ;
290+ pathParts . shift ( ) ;
286291 }
287-
292+
288293 const fullPath = Url . join ( rootFolder , pathParts . join ( "/" ) ) ;
289-
294+
290295 // Add back the query if present
291296 url = query ? `${ fullPath } ?${ query } ` : fullPath ;
292-
297+
293298 file = editorManager . getFile ( url , "uri" ) ;
294- } else if ( ! activeFile . uri ) {
299+ } else if ( ! activeFile . uri ) {
295300 file = activeFile ;
296- }
297-
301+ }
302+
298303 switch ( ext ) {
299304 case ".htm" :
300305 case ".html" :
@@ -557,8 +562,8 @@ async function run(
557562 let rootFolder = pathName ;
558563 if ( projectFolder !== undefined && pathName . includes ( projectFolder ) ) {
559564 rootFolder = projectFolder . url ;
560- } else {
561- rootFolder = pathName
565+ } else {
566+ rootFolder = pathName ;
562567 }
563568
564569 //make the uri absolute if necessary
0 commit comments