Bug 260633 - Make URL generation only remove #, if safe, and make gotoIRCURL stick the # back in as nessessary.

ChatZilla only.
r=samuel@sieb.net


git-svn-id: svn://10.0.0.236/trunk@162596 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
silver%warwickcompsoc.co.uk 2004-09-21 14:58:26 +00:00
parent 9d7c824a9d
commit 8a1096d37b
2 changed files with 18 additions and 5 deletions

View File

@ -2423,12 +2423,20 @@ function chan_geturl ()
{
var target = this.encodedName;
if (target.match(/^#[^!+&]/))
if ((target[0] == "#") &&
arrayIndexOf(this.parent.channelTypes, target[1]) == -1)
{
/* First character is "#" (which we're allowed to ommit), and the
* following character is NOT a valid prefix, so it's safe to remove.
*/
target = ecmaEscape(target.substr(1));
}
else
{
target = ecmaEscape(target);
}
target = target.replace("/", "%2f");
//target += "?charset=" + this.prefs["charset"];
return this.parent.parent.getURL(target);
}

View File

@ -1816,9 +1816,14 @@ function gotoIRCURL (url)
// with the Unicode forms.
var serv = network.primServ;
var target = url.target;
if (arrayIndexOf(serv.channelTypes, target[0]) == -1) {
target = serv.channelTypes[0] + target;
}
/* If we don't have a valid prefix, stick a "#" on it.
* NOTE: This is always a "#" so that URLs may be compared
* properly without involving the server (e.g. off-line).
*/
if (arrayIndexOf(serv.channelTypes, target[0]) == -1)
target = "#" + target;
var chan = new CIRCChannel(serv, null, target);
d = { channelName: chan.unicodeName, key: key,