File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ) ) ;
You can’t perform that action at this time.
0 commit comments