forked from CringeStudios/gamja
Handle IRC URLs without channel name
This commit is contained in:
parent
3562478946
commit
a120d79585
@ -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 {
|
||||
|
@ -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 };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user