Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.26.5 template mapping #1427

Open
stevenp012 opened this issue Feb 21, 2025 · 6 comments
Open

v0.26.5 template mapping #1427

stevenp012 opened this issue Feb 21, 2025 · 6 comments

Comments

@stevenp012
Copy link

Describe the bug

Latest update broke template mapping. When creating any note from template (including daily note template) it would try to open 'c:' and then whatever the filepath was and then 'C:' at the end. Reverting to the previous version fixed the issue.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. On v0.26.5 create a daily note template with a filepath field for note sorting.
  2. Enter 'Alt+t' to open a new daily note from template
  3. See error field

Expected behavior

As a user I expected it to create my daily note from my template.

Screenshots or Videos

No response

Operating System Version

Windows 10

Visual Studio Code Version

1.97.2

Additional context

No response

@riccardoferretti
Copy link
Collaborator

hi @stevenp012 thanks for reporting the issue.
As I am not on a windows machine, can you please expand both on the description of the bug and the reproduction steps, maybe including some screenshot?

@pderaaij could you please also take a look? 🙏

@GYMichaelCintas
Copy link

I am also having the exact same issue and wanted to add the steps and screenshots that I took.

Steps to reproduce the issue

  1. Open command palette and choose Foam - Create New Note from Template
  2. Choose daily-note.md template
  3. Input daily note title
  4. Bam - Error output

Screenshots

Error I am receiving

Image

Path provided for template (again working before the update)

Image

Workspace and user settings

Image

Operating System Version

Windows 11

Visual Studio Code Version

1.97.2

Additional Context

The exact steps mentioned above worked fine until the foam extension auto updated itself to v0.26.5.

I repeated the steps for the default foam templates without hardcoded file paths in the header and they seem to work no problem.

You can see what @stevenp012 is referring too in the error screenshot, showing the mkdir command not working as expected and not using the correct path as expected.

Any help is appreciated! Thanks!

@riccardoferretti
Copy link
Collaborator

Thanks, a few questions, does it happen with a relative path?
I tried to reproduce it locally (with an absolute path) and on Mac there are no issues, so it really seems related to the drive letter.
Also, does it happen whether you use c:\ or C:\ as your drive letter?

@sdibello-fled
Copy link

I also have the same issue as above. I am using absolute path to the foam template and now when I try to create any file from template there is an additional "C" at the end of the path, just like the example above.

When I modified my template to use relative pathing the problem goes away.

@GYMichaelCintas
Copy link

GYMichaelCintas commented Feb 26, 2025

@riccardoferretti - The change from absolute path to relative path in the YAML front-matter of the template works, and the daily note can now be created with the command palette function.

Re: using C:\ or c:\, I use C so I'm not even sure where the lower c is coming from when the command is executed.

@riccardoferretti
Copy link
Collaborator

As a side note, I would recommend always using relative paths.
If there are use cases that would make that impossible I'd love to hear them (as my feeling is that there shouldn't be)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants