Skip to content

Commit 051ce9e

Browse files
authored
Fix #3397 (#3398)
* WIP: Fix #3397 * fixup! WIP: Fix #3397 * fix: catch potential URIError threw from decodeURI
1 parent f367e9f commit 051ce9e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

browser/components/MarkdownPreview.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,17 @@ export default class MarkdownPreview extends React.Component {
11351135
}
11361136

11371137
// other case
1138-
shell.openExternal(href)
1138+
this.openExternal(href)
1139+
}
1140+
1141+
openExternal (href) {
1142+
try {
1143+
const success = shell.openExternal(href) || shell.openExternal(decodeURI(href))
1144+
if (!success) console.error('failed to open url ' + href)
1145+
} catch (e) {
1146+
// URI Error threw from decodeURI
1147+
console.error(e)
1148+
}
11391149
}
11401150

11411151
render () {

0 commit comments

Comments
 (0)