-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fix for ObsidianOpen
not working with links
#113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @shakesbeare! Could you just add some comments in the code to explain what's going on and why we have to do that?
@epwalsh Done! Plus, I added a Changelog entry. I was toying with the idea of mentioning the issue somewhere in the README, but wasn't sure how to phrase it given that it should work properly for most everyone now. Thoughts? |
I like the idea of adding a "## Known issues" section, and I think saying something like "this is edge case that won't affect most people" is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'll hold off on merging until you let me know if you want to add something to the README about known issues.
@epwalsh Went ahead and added the README section |
Potential fix for #107
Summary
This change modifies the
ObsidianOpen
command to additionally check if Plenary'smake_relative
method fails by attempting to find the vault root directory in the path after the call tomake_relative
. If the vault root directory is found, the new implementation simply substitutes out everything up to and including the root directory in an attempt to make the path work.Limitations
make_relative
and my proposed fix will fail. To fix this would require actually detecting if the vault is behind a link and following it in order to initialize the vault path as its absolute version from the get go. The only way I could find to accomplish this was to use an external library for Lua, which I figured might not be ideal to require as a dependency for what is really a bit of a niche bug.