Fix update url
This commit is contained in:
@@ -42,6 +42,13 @@ class UpdateNotifier extends React.Component<Props, {}> {
|
|||||||
rendererEvents.subscribe(updateAvailable, this.handleUpdate)
|
rendererEvents.subscribe(updateAvailable, this.handleUpdate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fixUrl(url: string, version: string) {
|
||||||
|
if (!/^http/.test(url)) {
|
||||||
|
return `https://github.com/thomasnordquist/MQTT-Explorer/releases/download/v${version}/${url}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return url
|
||||||
|
}
|
||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
rendererEvents.unsubscribeAll(updateAvailable)
|
rendererEvents.unsubscribeAll(updateAvailable)
|
||||||
}
|
}
|
||||||
@@ -156,7 +163,7 @@ class UpdateNotifier extends React.Component<Props, {}> {
|
|||||||
<div key={index}>
|
<div key={index}>
|
||||||
<Button
|
<Button
|
||||||
className={this.props.classes.download}
|
className={this.props.classes.download}
|
||||||
href={file.url}
|
href={this.fixUrl(file.url, updateInfo.version)}
|
||||||
>
|
>
|
||||||
<IconButton><CloudDownload /></IconButton>{this.urlToFilename(file.url)}
|
<IconButton><CloudDownload /></IconButton>{this.urlToFilename(file.url)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user