fix: find uppercased notes when referenced with lowercase
This commit fixes a bug where, if a note contained uppercase characters (for example `Note.md`) but was referred to using lowercase `(`[[note]]`), that note would not be found.
This commit is contained in:
parent
d330af3989
commit
e6fc611b58
@ -586,10 +586,11 @@ fn lookup_filename_in_vault<'a>(
|
|||||||
// sentence even if the note is capitalized for example) so we also try a case-insensitive
|
// sentence even if the note is capitalized for example) so we also try a case-insensitive
|
||||||
// lookup.
|
// lookup.
|
||||||
vault_contents.iter().find(|path| {
|
vault_contents.iter().find(|path| {
|
||||||
|
let path_lowered = PathBuf::from(path.to_string_lossy().to_lowercase());
|
||||||
path.ends_with(&filename)
|
path.ends_with(&filename)
|
||||||
|| path.ends_with(&filename.to_lowercase())
|
|| path_lowered.ends_with(&filename.to_lowercase())
|
||||||
|| path.ends_with(format!("{}.md", &filename))
|
|| path.ends_with(format!("{}.md", &filename))
|
||||||
|| path.ends_with(format!("{}.md", &filename.to_lowercase()))
|
|| path_lowered.ends_with(format!("{}.md", &filename.to_lowercase()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ Link to [pure-markdown-examples > Heading 1](pure-markdown-examples.md#heading-1
|
|||||||
|
|
||||||
Link to [pure markdown examples](pure-markdown-examples.md#heading-1).
|
Link to [pure markdown examples](pure-markdown-examples.md#heading-1).
|
||||||
|
|
||||||
|
Link to [uppercased-note](Uppercased-note.md).
|
||||||
|
|
||||||
Link within backticks: `[[pure-markdown-examples]]`
|
Link within backticks: `[[pure-markdown-examples]]`
|
||||||
|
|
||||||
````
|
````
|
||||||
|
0
tests/testdata/input/main-samples/Uppercased-note.md
vendored
Normal file
0
tests/testdata/input/main-samples/Uppercased-note.md
vendored
Normal file
@ -6,6 +6,8 @@ Link to [[pure-markdown-examples#Heading 1]].
|
|||||||
|
|
||||||
Link to [[pure-markdown-examples#Heading 1|pure markdown examples]].
|
Link to [[pure-markdown-examples#Heading 1|pure markdown examples]].
|
||||||
|
|
||||||
|
Link to [[uppercased-note]].
|
||||||
|
|
||||||
Link within backticks: `[[pure-markdown-examples]]`
|
Link within backticks: `[[pure-markdown-examples]]`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user