Skip to content

Commit

Permalink
fix(plugins/plugin-core-support): UpdateChecker always reports that a…
Browse files Browse the repository at this point in the history
…n update is available

Fixes #4918
  • Loading branch information
starpit committed Jun 18, 2020
1 parent c5beb4a commit 2c21988
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/plugin-core-support/src/components/UpdateChecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ interface State {
dulyNoted: string
}

/**
* GitHub gives back "v8.10.0" and the Kui version command gives back "8.10.0".
*
* @see https://github.com/IBM/kui/issues/4918
*
*/
function stripOffPrefixV(githubVersionString: string): string {
return githubVersionString.replace(/^v/, '')
}

export default class UpdateChecker extends React.PureComponent<Props, State> {
public constructor(props: Props) {
super(props)
Expand Down Expand Up @@ -86,6 +96,7 @@ export default class UpdateChecker extends React.PureComponent<Props, State> {
.then(res => {
return res.body.children.filter(_ => _.name === 'entry')[0].children.find(_ => _.name === 'title').value
})
.then(stripOffPrefixV) // see https://github.com/IBM/kui/issues/4918
.then(latestVersion =>
this.setState(curState => ({
latestVersion,
Expand Down

0 comments on commit 2c21988

Please sign in to comment.