Skip to content

Commit 0edd527

Browse files
committed
Merge branch 'master' of github.com:nhaouari/obsidian-textgenerator-plugin
2 parents 790b07a + 463af12 commit 0edd527

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/scope/context-manager.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,16 @@ export default class ContextManager {
557557
if (elements[i].type == "image_url" && elements[i].image_url?.url && !elements[i].image_url.url.startsWith("http")) {
558558
// @ts-ignore
559559
const path = elements[i].image_url?.url;
560-
561-
const tfile = await this.app.vault.getFileByPath(path);
562-
563-
if (!tfile) continue;
560+
const attachmentFolderPath = this.app.vault.getConfig("attachmentFolderPath"); // it works to getConfig in obsidian v1.6.5
561+
console.log(path,attachmentFolderPath)
562+
563+
let tfile = await this.app.vault.getFileByPath(path);
564+
if (!tfile) {
565+
// try to find in attachment folder, base user's preferences
566+
tfile = await this.app.vault.getFileByPath(attachmentFolderPath + "/" + path);
567+
if (!tfile) continue;
568+
}
569+
564570
const mimtype = mime.lookup(tfile.extension) || ""
565571

566572
const buff = convertArrayBufferToBase64Link(await this.app.vault.readBinary(tfile as any), mimtype)

0 commit comments

Comments
 (0)