-
Notifications
You must be signed in to change notification settings - Fork 647
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
Invalid characters for $FOAM_TITLE
used in .foam_template.filepath
fails silently
#1216
Comments
If you work around the failing file creation using the variable transform provided above, here is some of the duplication (as described in #1215) which can occur. I think the positions of the This template... ---
foam_template:
filepath: "$FOAM_DATE_YEAR-$FOAM_DATE_MONTH-$FOAM_DATE_DATE $FOAM_TITLE.md"
title: $1
---
# $FOAM_DATE_YEAR-$FOAM_DATE_MONTH-$FOAM_DATE_DATE ${1:$FOAM_TITLE}
Some text.
$1
...with title "My daily note" becomes the note: ---
title: My daily note daily note
---
# 2023-04-25 ${1:My daily note2023-04-25 ${1:-04-25 My daily note daily note
Some text.
My daily note daily note As you can see, duplication happens even without invalid characters. |
partially fixed in #1232 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
See title.
Small Reproducible Example
No response
Steps to Reproduce the Bug or Issue
$FOAM_TITLE
as part of.foam_template.filepath
's value.Invalid "Characters"
Expected behavior
Automatically strip invalid characters from the title and use that as the valid file name (as already happens when
$FOAM_TITLE
is outside of.foam_template.filepath
). Of course, mentions of$FOAM_TITLE
elsewhere should retain all the submitted characters.Screenshots or Videos
No response
Operating System Version
Windows 11
Visual Studio Code Version
VSCodium 1.77.3
Additional context
This can be worked around by using
filepath: "${FOAM_TITLE/[\/?*\"<>|:\\]/_/g}.md"
to replace each of Windows' invalid characters with an underscore. This only works around the failure to create the file, however, if you now provide a title with or without an invalid character, another related bug is encountered at this point (duplication of text), see #1215.Foam should probably handle these invalid characters instead of the user having to use VS Code variable transforms such as above.
The text was updated successfully, but these errors were encountered: