diff --git a/lib/utils/link_resolver.dart b/lib/utils/link_resolver.dart index d0a933bf..5aa51e4c 100644 --- a/lib/utils/link_resolver.dart +++ b/lib/utils/link_resolver.dart @@ -15,10 +15,15 @@ class LinkResolver { } var rootFolder = inputNote.parent.rootFolder; - assert(l.filePath.startsWith(rootFolder.folderPath)); - var spec = l.filePath.substring(rootFolder.folderPath.length + 1); + if (l.filePath.startsWith(rootFolder.folderPath)) { + var spec = l.filePath.substring(rootFolder.folderPath.length); + if (spec.startsWith('/')) { + spec = spec.substring(1); + } + return _getNoteWithSpec(rootFolder, spec); + } - return _getNoteWithSpec(rootFolder, spec); + return null; } Note resolve(String link) {