@ -152,19 +152,19 @@ function getContentDisposition(filename: string) {
return ` file; filename=" ${ sanitizedFilename } "; filename*=UTF-8'' ${ sanitizedFilename } ` ;
return ` file; filename=" ${ sanitizedFilename } "; filename*=UTF-8'' ${ sanitizedFilename } ` ;
}
}
const STRING_MIME_TYPES = [
const STRING_MIME_TYPES = new Set ( [
"application/javascript" ,
"application/javascript" ,
"application/x-javascript" ,
"application/x-javascript" ,
"application/json" ,
"application/json" ,
"application/x-sql" ,
"application/x-sql" ,
"image/svg+xml"
"image/svg+xml"
] ;
] ) ;
function isStringNote ( type : string | undefined , mime : string ) {
function isStringNote ( type : string | undefined , mime : string ) {
// render and book are string note in the sense that they are expected to contain empty string
// render and book are string note in the sense that they are expected to contain empty string
return ( type && [ "text" , "code" , "relationMap" , "search" , "render" , "book" , "mermaid" , "canvas" ] . includes ( type ) )
return ( type && [ "text" , "code" , "relationMap" , "search" , "render" , "book" , "mermaid" , "canvas" ] . includes ( type ) )
|| mime . startsWith ( 'text/' )
|| mime . startsWith ( 'text/' )
|| STRING_MIME_TYPES . include s( mime ) ;
|| STRING_MIME_TYPES . ha s( mime ) ;
}
}
function quoteRegex ( url : string ) {
function quoteRegex ( url : string ) {