Skip to content

Commit

Permalink
fix(kb.gbapp): Skips blank answers lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Aug 26, 2022
1 parent 6af3054 commit 143e425
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/kb.gbapp/services/KBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,23 @@ export class KBService implements IGBKBService {
const mediaFilename = urlJoin(path.dirname(filePath), '..', 'articles', answer);
if (Fs.existsSync(mediaFilename)) {

// TODO: Convert DOCX to MD.
// Tries to load .docx file from Articles folder.

answer = Fs.readFileSync(mediaFilename, 'utf8');
if (answer.indexOf('.docx') > -1) {
answer = await this.getTextFromFile(filePath);
}
else {
// Loads normally markdown file.

answer = Fs.readFileSync(mediaFilename, 'utf8');
}
format = '.md';
media = path.basename(mediaFilename);
} else {
GBLog.info(`[GBImporter] File not found: ${mediaFilename}.`);
answer = '';
if (answer.indexOf('.md') > -1) {
GBLog.info(`[GBImporter] File not found: ${mediaFilename}.`);
answer = '';
}
}
}

Expand Down

0 comments on commit 143e425

Please sign in to comment.