SilentVoid13 / Templater

A template plugin for obsidian
https://silentvoid13.github.io/Templater
GNU Affero General Public License v3.0
3.13k stars 186 forks source link

First character of file path cut off in command palette if no templates folder set #1436

Open Nostromos opened 3 weeks ago

Nostromos commented 3 weeks ago

Plugin information (please complete the following information):

Describe the bug When I use any templater command palette option, the first character of every template entry is cut off IF no template folder location is configured. It's not a serious bug but it is kinda annoying. See attached.

Expected behavior Full pathnames with no missing characters.

Screenshots

Screenshot 2024-08-20 at 10 52 36 AM (2)

Additional context I have a pretty vanilla install of Obsidian - I'm really new to it. No custom themes and the only setting I've changed for anything is viewing properties as source.

I'll probably dig into this and put in a PR if this isn't touched by next week.

Zachatoo commented 3 weeks ago

I'm guessing it was caused by this recent PR #1418

They were likely testing with Templater settings that had a template folder path that didn't end with a /, and your template folder path probably does end with a /. The code probably needs to be updated to handle both cases.

Nostromos commented 3 weeks ago

Gah great point. I should have looked at recent PRs. If it's a matter of file paths, seems an easy enough fix and I've been itching to contribute anywhere that'll have me.

Mind if I take a swing? Might take me a day or two.

Zachatoo commented 3 weeks ago

Absolutely, will definitely accept a PR to fix this when you find time, thanks!

I-Pch commented 1 week ago

I have no idea if this would be useful in any way 😇 , but just in case: This bug is also reproducible if one freshly install and enable Templater (i.e.: without even opening Templater's settings) and then click on Templater's icon in the ribbon to trigger the template selection modal.

(Seen in the Sandbox Vault of Obsidian 1.7.1 (Installer 1.6.7) + Templater 2.6.0)

Erallie commented 1 week ago

Hey, I just want to throw this out there, that this can easily be fixed by just checking to see if the path is empty before removing the length of the path (plus one) from the beginning of the string. I can easily fix it, but I know that @Nostromos requested to be the contributor, so I'm letting you know this so that maybe he can consider it in his Pull request?

Or if you're too busy Nostromos, I could take a stab.

Erallie commented 1 week ago

I have no idea if this would be useful in any way 😇 , but just in case: This bug is also reproducible if one freshly install and enable Templater (i.e.: without even opening Templater's settings) and then click on Templater's icon in the ribbon to trigger the template selection modal.

(Seen in the Sandbox Vault of Obsidian 1.7.1 (Installer 1.6.7) + Templater 2.6.0)

@I-Pch Yes, I believe this is probably because on a newly installed vault, the template folder is empty, so it's basically the same problem.

Nostromos commented 2 days ago

@Erallie All you! I had kid stuff pop up and interviews and never got around to it.

Erallie commented 1 day ago

I created pull request #1454 to fix this.