A space at the end of a file name breaks autocomplete

Steps to reproduce

If you type a trailing-space in a note’s filename, Obsidian will strip out that space.

However, if you add a space externally using your filesystem (or if a plugin generates it), it is possible for the filename to retain the space: Testing Apples .md

The bug: If you then attempt to link to that note, Obsidian’s autocomplete will find “Testing Apples” with no space, and create a wikilink. But the wikilink will not be valid. It will link to a non-existing note.

screenshot_2022-05-12_08-57-37

Additional quirk: If you drag-and-drop that note "Testing Apples " with a space into a note, it will generate a wikilink with a space at the end. But the link won’t work. This is expected enough because of the way Markdown handles whitespace. So that isn’t the bug, per se.

Environment

Tested and reproducible both on MacOS and Windows 10.

thanks!