Skip to content

Commit

Permalink
fix(desktop): preload static converted courseware bug (#827)
Browse files Browse the repository at this point in the history
* fix(desktop): preload static converted courseware bug

* chore: add comment
  • Loading branch information
hyrious committed Jul 29, 2021
1 parent 7a44a0e commit d503568
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions desktop/renderer-app/src/utils/CoursewarePreloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ class CoursewarePreloader {
downloader.once("end", async info => {
try {
await extractZIP(info.filePath, coursewareDir);
await copy(tempCoursewareDir, coursewareDir);
await remove(tempCoursewareDir);
// TODO: the convert service may fail in some cases, which
// results in incorrect zip structure.
// when it occurs, we manually correct it by code below.
if (await pathExists(tempCoursewareDir)) {
await copy(tempCoursewareDir, coursewareDir);
await remove(tempCoursewareDir);
}
await remove(info.filePath);
} catch (e) {
console.error(e);
Expand Down

0 comments on commit d503568

Please sign in to comment.