|
|
@ -175,24 +175,29 @@ export function slash(p: string): string {
|
|
|
|
return p.replace(/\\/g, '/')
|
|
|
|
return p.replace(/\\/g, '/')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const extraExts =
|
|
|
|
const KNOWN_EXTENSIONS = new Set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function treatAsHtml(filename: string): boolean {
|
|
|
|
|
|
|
|
if (KNOWN_EXTENSIONS.size === 0) {
|
|
|
|
|
|
|
|
const extraExts =
|
|
|
|
(typeof process === 'object' && process.env.VITE_EXTRA_EXTENSIONS) ||
|
|
|
|
(typeof process === 'object' && process.env.VITE_EXTRA_EXTENSIONS) ||
|
|
|
|
(import.meta as any).env?.VITE_EXTRA_EXTENSIONS ||
|
|
|
|
(import.meta as any).env?.VITE_EXTRA_EXTENSIONS ||
|
|
|
|
''
|
|
|
|
''
|
|
|
|
|
|
|
|
|
|
|
|
// md, html? are intentionally omitted, see treatAsHtml
|
|
|
|
// md, html? are intentionally omitted
|
|
|
|
const KNOWN_EXTENSIONS = new Set(
|
|
|
|
;(
|
|
|
|
(
|
|
|
|
'3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,' +
|
|
|
|
'3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,' +
|
|
|
|
'doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,' +
|
|
|
|
'eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,' +
|
|
|
|
'man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,' +
|
|
|
|
'mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,' +
|
|
|
|
'opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,' +
|
|
|
|
'p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,' +
|
|
|
|
'tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,' +
|
|
|
|
'tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip' +
|
|
|
|
'yaml,yml,zip' +
|
|
|
|
(extraExts && typeof extraExts === 'string' ? ',' + extraExts : '')
|
|
|
|
(extraExts && typeof extraExts === 'string' ? ',' + extraExts : '')
|
|
|
|
).split(',')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.split(',')
|
|
|
|
|
|
|
|
.forEach((ext) => KNOWN_EXTENSIONS.add(ext))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function treatAsHtml(filename: string): boolean {
|
|
|
|
|
|
|
|
const ext = filename.split('.').pop()
|
|
|
|
const ext = filename.split('.').pop()
|
|
|
|
|
|
|
|
|
|
|
|
return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase())
|
|
|
|
return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase())
|
|
|
|