Bug fix
This commit is contained in:
parent
8e783b0eb6
commit
455cdc4bf0
@ -111,6 +111,7 @@ export default function Note(props) {
|
|||||||
if (typeof f === "string") {
|
if (typeof f === "string") {
|
||||||
return f.split(UrlRegex).map(a => {
|
return f.split(UrlRegex).map(a => {
|
||||||
if (a.startsWith("http")) {
|
if (a.startsWith("http")) {
|
||||||
|
try {
|
||||||
let url = new URL(a);
|
let url = new URL(a);
|
||||||
let ext = url.pathname.toLowerCase().match(FileExtensionRegex);
|
let ext = url.pathname.toLowerCase().match(FileExtensionRegex);
|
||||||
if (ext) {
|
if (ext) {
|
||||||
@ -133,6 +134,9 @@ export default function Note(props) {
|
|||||||
} else {
|
} else {
|
||||||
return <a href={url}>{url.toString()}</a>
|
return <a href={url}>{url.toString()}</a>
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(`Not a valid url: ${a}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
});
|
});
|
||||||
|
@ -43,6 +43,7 @@ export default class Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OnMessage(e) {
|
OnMessage(e) {
|
||||||
|
if (e.data.length > 0) {
|
||||||
let msg = JSON.parse(e.data);
|
let msg = JSON.parse(e.data);
|
||||||
let tag = msg[0];
|
let tag = msg[0];
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
@ -69,6 +70,7 @@ export default class Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnError(e) {
|
OnError(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user