fix(baoyu-md, baoyu-post-to-x): decode URL-encoded image paths

Obsidian creates markdown image links with URL-encoded filenames
(e.g. `Pasted%20image%2020260524.png`) but the actual file has spaces.
Add `decodeURIComponent()` before path resolution in both baoyu-md's
shared `resolveImagePath()` and baoyu-post-to-x's independent version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chao Zheng
2026-05-27 09:09:46 +08:00
committed by Jim Liu 宝玉
parent e1c0ff7c02
commit 876f01ac19
3 changed files with 22 additions and 6 deletions
+4 -3
View File
@@ -103,9 +103,10 @@ export async function resolveImagePath(
return localPath;
}
const resolved = path.isAbsolute(imagePath)
? imagePath
: path.resolve(baseDir, imagePath);
const decoded = decodeURIComponent(imagePath);
const resolved = path.isAbsolute(decoded)
? decoded
: path.resolve(baseDir, decoded);
return resolveLocalWithFallback(resolved, logLabel);
}