Skip to content

Commit b8bba77

Browse files
committed
Fixes #1
1 parent cb71e43 commit b8bba77

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Constants.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ public static class Constants
77
public const string SyncIconPath = "Images/refresh.png";
88
public const string RecentIconPath = "Images/recent.png";
99
public const string RecentPageIconPath = "Images/recent_page.png";
10-
10+
public const string WarningLogoPath = "Images/warning.png";
11+
1112
public const string StructureKeyword = "nb:\\";
1213
public const string RecentKeyword = "rcntpgs:";
1314
}

Images/warning.png

1.95 KB
Loading

Main.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ public List<Result> Query(Query query)
112112
if (query.FirstSearch.StartsWith(Constants.StructureKeyword))
113113
return notebookExplorer.Explore(query);
114114

115+
//Check for invalid start of query i.e. symbols
116+
if (!char.IsLetterOrDigit(query.Search[0]))
117+
return new List<Result>()
118+
{
119+
new Result
120+
{
121+
Title = "Invalid query",
122+
SubTitle = "The first character of the search must be a letter or a digit",
123+
IcoPath = Constants.WarningLogoPath,
124+
}
125+
};
115126
//Default search
116127
var searches = OneNoteProvider.FindPages(query.Search)
117128
.Select(pg => rc.CreatePageResult(pg, context.API.FuzzySearch(query.Search, pg.Name).MatchData));

0 commit comments

Comments
 (0)