@@ -357,7 +357,7 @@ function handleWatch(socket: WebSocket, req: IncomingMessage, {root, style}: Con
357357
358358 async function hello ( { path : initialPath , hash : initialHash } : { path : string ; hash : string } ) : Promise < void > {
359359 if ( markdownWatcher || attachmentWatcher ) throw new Error ( "already watching" ) ;
360- path = initialPath ;
360+ path = decodeURIComponent ( initialPath ) ;
361361 if ( ! ( path = normalize ( path ) ) . startsWith ( "/" ) ) throw new Error ( "Invalid path: " + initialPath ) ;
362362 if ( path . endsWith ( "/" ) ) path += "index" ;
363363 path += ".md" ;
@@ -451,7 +451,7 @@ function diffCode(oldCode: Map<string, string>, newCode: Map<string, string>): C
451451 return patch ;
452452}
453453
454- type FileDeclaration = { name : string ; mimeType : string | null ; path : string } ;
454+ type FileDeclaration = { name : string ; mimeType ? : string ; path : string } ;
455455type FilePatch = { removed : string [ ] ; added : FileDeclaration [ ] } ;
456456
457457function diffFiles ( oldFiles : Map < string , string > , newFiles : Map < string , string > ) : FilePatch {
@@ -463,7 +463,7 @@ function diffFiles(oldFiles: Map<string, string>, newFiles: Map<string, string>)
463463 }
464464 for ( const [ name , path ] of newFiles ) {
465465 if ( oldFiles . get ( name ) !== path ) {
466- patch . added . push ( { name, mimeType : mime . getType ( name ) , path} ) ;
466+ patch . added . push ( { name, mimeType : mime . getType ( name ) ?? undefined , path} ) ;
467467 }
468468 }
469469 return patch ;
0 commit comments