Handle IRC URLs without channel name

This commit is contained in:
Simon Ser
2021-10-13 16:47:01 +02:00
parent 3562478946
commit a120d79585
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -906,7 +906,7 @@ export default class App extends Component {
event.preventDefault(); event.preventDefault();
let buf = State.getBuffer(this.state, { server: serverID, name: url.channel }); let buf = State.getBuffer(this.state, { server: serverID, name: url.channel || SERVER_BUFFER });
if (buf) { if (buf) {
this.switchBuffer(buf.id); this.switchBuffer(buf.id);
} else { } else {
+4 -4
View File
@@ -666,17 +666,17 @@ export function parseURL(str) {
let i = str.indexOf("/"); let i = str.indexOf("/");
if (i < 0) { if (i < 0) {
return null; return { host: str };
} }
let host = str.slice(0, i); let host = str.slice(0, i);
str = str.slice(i + 1); str = str.slice(i + 1);
// TODO: handle URLs with query params // TODO: handle URLs with query params
if (!str.startsWith("#")) { let channel = null;
return null; if (str.startsWith("#")) {
channel = str;
} }
let channel = str;
return { host, channel }; return { host, channel };
} }