Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle corrupted update file #1093

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/api/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ export namespace VersionHelper {
lastCheck: 0,
}
if (await fs.pathExists(newVersionInfoFilePath)) {
newVersionInfo = (await fs.readJson(newVersionInfoFilePath, { encoding: 'utf8' })) as NewVersionInfoData
try {
newVersionInfo = (await fs.readJson(newVersionInfoFilePath, { encoding: 'utf8' })) as NewVersionInfoData
} catch {
// file is corrupted
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you output the content of the corrupted file ?
it may help to know what is corrupted

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can put it in debug only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But anyway, I haven't found how to change outputlevel using env variables.
So, user won't see it anyway.

}
}

// Check cache, if it is already known that newer version available
Expand All @@ -244,9 +248,9 @@ export namespace VersionHelper {
return isCachedNewerVersionAvailable
}

/**
* Indicates if stable version of Eclipse Che is specified or meant implicitly.
*/
/**
* Indicates if stable version of Eclipse Che is specified or meant implicitly.
*/
export function isDeployingStableVersion(flags: any): boolean {
return !!flags.version || !ChectlContext.get().isNightly
}
Expand Down