Issue: metadata.fmRelFilePath is not a relative path on windows #716

Closed
opened 2026-10-05 03:01:54 +02:00 by adam · 2 comments
Owner

Describe the bug
metadata.fmRelFilePath is not a relative path on windows

To Reproduce
I followed the guide here: https://frontmatter.codes/docs/ui-extensibility#registering-a-card-image
It has this bit of code:

registerCardImage(async (filePath, metadata) => {
  return `<span>Your HTML for the card image</span>`;
});

The metadata object is not well documented, but investigating, I could find the metadata.fmRelFilePath property inside it, wich value is the relative path of the document, and wich I used to define the path of the image
On linux, all worked ok.
But on windows, this property contains an absolute path, including drive letter. I don't know if it matters, but for my work on windows, project was on d:\ drive, not c:\

Workaround
As a workaround, I used the metadata.fmRelFileWsPath property, wich contains a relative path, once stripped the [[workspace]] part at the beginning of its value. This works on linux and windows.

Expected behavior
metadata.fmRelFilePath should be a relative path, may it be on windows or on linux.

Device:

  • OS: windows
  • Front Matter CMS Version [10.7.0]
**Describe the bug** `metadata`.`fmRelFilePath` is not a relative path on windows **To Reproduce** I followed the guide here: https://frontmatter.codes/docs/ui-extensibility#registering-a-card-image It has this bit of code: ```js registerCardImage(async (filePath, metadata) => { return `<span>Your HTML for the card image</span>`; }); ``` The `metadata` object is not well documented, but investigating, I could find the `metadata`.`fmRelFilePath` property inside it, wich value is the relative path of the document, and wich I used to define the path of the image On linux, all worked ok. But on windows, this property contains an absolute path, including drive letter. I don't know if it matters, but for my work on windows, project was on `d:\` drive, not `c:\` **Workaround** As a workaround, I used the `metadata`.`fmRelFileWsPath` property, wich contains a relative path, once stripped the `[[workspace]]` part at the beginning of its value. This works on linux and windows. **Expected behavior** `metadata`.`fmRelFilePath` should be a relative path, may it be on windows or on linux. **Device:** - OS: windows - Front Matter CMS Version [10.7.0] <!-- github-sync-id:2852341238 -->
adam closed this issue 2026-10-05 03:01:54 +02:00
Author
Owner

Thanks! I implemented a fix earlier this week for the parsing of Windows paths. It seems that in the latest version of VSCode, there has been a change in how Windows paths are returned. In some cases, it provides a drive letter as uppercase and lowercase in other cases. I believe this is what is causing the issue here as well.

Could you give the latest beta version a try to see if that version already fixes the issue?

https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta

Thanks! I implemented a fix earlier this week for the parsing of Windows paths. It seems that in the latest version of VSCode, there has been a change in how Windows paths are returned. In some cases, it provides a drive letter as uppercase and lowercase in other cases. I believe this is what is causing the issue here as well. Could you give the latest beta version a try to see if that version already fixes the issue? https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta <!-- github-comment-id:2658591583 -->
Author
Owner

Hi ! Thank your for your answer, and sorry for the delay of my answer, I do not access widows machines verty often. It turns out that the bug it still here on latest version 10.8.0
FmRelFilePath still contains the full path with drive letter (d:/ on my case), not the relative path. I think this issue should be reopened

Hi ! Thank your for your answer, and sorry for the delay of my answer, I do not access widows machines verty often. It turns out that the bug it still here on latest version 10.8.0 FmRelFilePath still contains the full path with drive letter (d:/ on my case), not the relative path. I think this issue should be reopened <!-- github-comment-id:2726934302 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#716