mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-13 06:19:46 +08:00
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:
@@ -181,11 +181,12 @@ async function resolveImagePath(imagePath: string, baseDir: string, tempDir: str
|
||||
return localPath;
|
||||
}
|
||||
|
||||
if (path.isAbsolute(imagePath)) {
|
||||
return imagePath;
|
||||
const decoded = decodeURIComponent(imagePath);
|
||||
if (path.isAbsolute(decoded)) {
|
||||
return decoded;
|
||||
}
|
||||
|
||||
return path.resolve(baseDir, imagePath);
|
||||
return path.resolve(baseDir, decoded);
|
||||
}
|
||||
|
||||
function escapeHtml(text: string): string {
|
||||
|
||||
Reference in New Issue
Block a user