File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ export class FieldMapper {
109109 }
110110
111111 if ( frontmatter [ this . mapping . timeEntries ] !== undefined ) {
112- mapped . timeEntries = frontmatter [ this . mapping . timeEntries ] ;
112+ // Ensure timeEntries is always an array
113+ const timeEntriesValue = frontmatter [ this . mapping . timeEntries ] ;
114+ mapped . timeEntries = Array . isArray ( timeEntriesValue ) ? timeEntriesValue : [ ] ;
113115 }
114116
115117 if ( frontmatter [ this . mapping . completeInstances ] !== undefined ) {
@@ -137,7 +139,8 @@ export class FieldMapper {
137139
138140 // Handle time entries
139141 if ( frontmatter . timeEntries !== undefined ) {
140- mapped . timeEntries = frontmatter . timeEntries ;
142+ // Ensure timeEntries is always an array
143+ mapped . timeEntries = Array . isArray ( frontmatter . timeEntries ) ? frontmatter . timeEntries : [ ] ;
141144 }
142145
143146 return mapped ;
Original file line number Diff line number Diff line change @@ -226,6 +226,10 @@ export class NaturalLanguageParser {
226226 const candidates = [ config . label , config . value ] ;
227227
228228 for ( const candidate of candidates ) {
229+ // Skip empty candidates
230+ if ( ! candidate || candidate . trim ( ) === '' ) {
231+ continue ;
232+ }
229233 const match = this . findStatusMatch ( text , candidate ) ;
230234 if ( match ) {
231235 result . status = config . value ;
@@ -251,6 +255,11 @@ export class NaturalLanguageParser {
251255 * Returns the match details or null if no valid match found.
252256 */
253257 private findStatusMatch ( text : string , statusText : string ) : { fullMatch : string ; startIndex : number } | null {
258+ // Guard against empty status text to prevent infinite loop
259+ if ( ! statusText || statusText . trim ( ) === '' ) {
260+ return null ;
261+ }
262+
254263 const lowerText = text . toLowerCase ( ) ;
255264 const lowerStatus = statusText . toLowerCase ( ) ;
256265
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export class StatusSuggestionService {
3838 const q = query . toLowerCase ( ) ;
3939 return statusConfigs
4040 . filter ( s => s && typeof s . value === 'string' && typeof s . label === 'string' )
41+ . filter ( s => s . value . trim ( ) !== '' && s . label . trim ( ) !== '' ) // Filter out empty values
4142 . filter ( s => s . value . toLowerCase ( ) . includes ( q ) || s . label . toLowerCase ( ) . includes ( q ) )
4243 . slice ( 0 , limit )
4344 . map ( s => ( {
You can’t perform that action at this time.
0 commit comments