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

View File

@ -906,7 +906,7 @@ export default class App extends Component {
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) {
this.switchBuffer(buf.id);
} else {

View File

@ -666,17 +666,17 @@ export function parseURL(str) {
let i = str.indexOf("/");
if (i < 0) {
return null;
return { host: str };
}
let host = str.slice(0, i);
str = str.slice(i + 1);
// TODO: handle URLs with query params
if (!str.startsWith("#")) {
return null;
let channel = null;
if (str.startsWith("#")) {
channel = str;
}
let channel = str;
return { host, channel };
}