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

Fix syncing when ancestors contain file basename #44

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Fix syncing when ancestors contain file basename #44

merged 1 commit into from
Mar 10, 2022

Conversation

erykwalder
Copy link
Contributor

Currently, renaming a file through the header fails when the current file basename is contained in the name of a parent folder. This is because replace replaces the first occurence, not the last. This can be seen if you try to update the title heading in a file located at Tests/Test.md.

This PR builds the path on top of the last parent instead of replacing. Since the path is normalized during rename, it's safe even if the file is in the base folder with a path of "/".

Currently, renaming a file through the header fails when the current file basename is contained in the name of a parent folder. This is because replace replaces the first occurence, not the last. This can be seen if you try to update the title heading in a file located at `Tests/Test.md`.

This PR builds the path on top of the last parent instead of replacing. Since the path is normalized during rename, it's safe even if the file is in the base folder with a path of "/".
@dvcrn
Copy link
Owner

dvcrn commented Mar 10, 2022

Good find and thanks for the PR!

@dvcrn dvcrn merged commit 2ed0d17 into dvcrn:master Mar 10, 2022
@erykwalder erykwalder deleted the patch-1 branch March 10, 2022 04:52
@dvcrn
Copy link
Owner

dvcrn commented Mar 11, 2022

Released in 1.6.0

@erykwalder
Copy link
Contributor Author

Thanks! Thanks for all your work on this plugin too! Much appreciated!

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

Successfully merging this pull request may close these issues.

2 participants