Use fetch() to get app://... assets
This commit is contained in:
Alan Grainger 2024-04-06 08:13:47 +02:00
parent b0a756cc49
commit c3933e996f

View file

@ -335,13 +335,7 @@ export default class Note {
if (!src) continue
let content
let filepath = ''
if (src.startsWith('app://')) {
const srcMatch = src.match(/app:\/\/\w+\/([^?#]+)/)
if (srcMatch) {
filepath = window.decodeURIComponent(srcMatch[1])
content = await FileSystemAdapter.readLocalFile(filepath)
}
} else if (src.match(/^https?:\/\/localhost/) || !src.startsWith('http')) {
if (src.match(/^https?:\/\/localhost/) || !src.startsWith('http')) {
filepath = src
try {
const res = await fetch(filepath)