Skip to content

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

Open
@lamyseba

Description

@lamyseba

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions