Fix jumping to note from Khoj Obsidian search modal result on Windows

- Issue
  The file path separator by khoj server and the Obsidian vault were
  different on Windows
- Fix
  Normalize file path to use forward slash(/) to find the matching
  note file in the Obsidian vault for jump to it

Resolves #177
This commit is contained in:
Debanjum Singh Solanky 2023-03-05 21:07:54 -06:00
parent 7184508784
commit 4fb628975c

View file

@ -109,7 +109,7 @@ export class KhojModal extends SuggestModal<SearchResult> {
.sort((a, b) => b.path.length - a.path.length)
// The first match is the best file match across OS
// e.g Khoj server on Linux, Obsidian vault on Android
.find(file => result.file.endsWith(file.path))
.find(file => result.file.replace(/\\/g, "/").endsWith(file.path))
// Open vault file at heading of chosen search result
if (file_match) {