mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
fix(link): search from URL not working (closes #1335)
This commit is contained in:
@@ -198,7 +198,7 @@ function calculateHash({ notePath, ntxId, hoistedNoteId, viewScope = {} }: NoteC
|
||||
return hash;
|
||||
}
|
||||
|
||||
function parseNavigationStateFromUrl(url: string | undefined) {
|
||||
export function parseNavigationStateFromUrl(url: string | undefined) {
|
||||
if (!url) {
|
||||
return {};
|
||||
}
|
||||
@@ -209,11 +209,7 @@ function parseNavigationStateFromUrl(url: string | undefined) {
|
||||
}
|
||||
|
||||
const hash = url.substr(hashIdx + 1); // strip also the initial '#'
|
||||
const [notePath, paramString] = hash.split("?");
|
||||
|
||||
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) {
|
||||
return {};
|
||||
}
|
||||
let [notePath, paramString] = hash.split("?");
|
||||
|
||||
const viewScope: ViewScope = {
|
||||
viewMode: "default"
|
||||
@@ -242,6 +238,10 @@ function parseNavigationStateFromUrl(url: string | undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) {
|
||||
return { searchString }
|
||||
}
|
||||
|
||||
return {
|
||||
notePath,
|
||||
noteId: treeService.getNoteIdFromUrl(notePath),
|
||||
|
||||
Reference in New Issue
Block a user