Skip to content

Commit e534179

Browse files
committed
fix exception on bad url
1 parent 5ab94d4 commit e534179

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/MarkdownRenderer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ function PlainImage(imageProps) {
176176
}
177177

178178
function isGif(src: string) {
179-
const srcUrl = new URL(src);
180-
return srcUrl.pathname.endsWith('gif');
179+
try {
180+
const srcUrl = new URL(src);
181+
return srcUrl.pathname.endsWith('gif');
182+
} catch (e) {
183+
return false;
184+
}
181185
}
182186

183187
function Image(props) {

0 commit comments

Comments
 (0)