Skip to content

Commit 64f6d2a

Browse files
committed
escape fixes
1 parent f6ec4b7 commit 64f6d2a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Spixi/Resources/Raw/html/js/chat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,15 +495,15 @@ function linkify(text) {
495495
}
496496

497497
function visitLink(url) {
498-
location.href = "ixian:openLink:" + escapeParameter(url);
498+
location.href = "ixian:openLink:" + url;
499499
hideModalDialog();
500500
}
501501

502502
function onExternalLink(e, url) {
503503
var title = SL_Modals["externalLinkTitle"];
504504
var body = SL_Modals["externalLinkBody"];
505505
body = body.replace("{0}", "<b>" + url + "</b>");
506-
var visitButtonHtml = "<div onclick=\"visitLink('" + url + "');\">" + SL_Modals["externalLinkButtonVisit"] + "</div>";
506+
var visitButtonHtml = "<div onclick=\"visitLink('" + escapeParameter(url) + "');\">" + SL_Modals["externalLinkButtonVisit"] + "</div>";
507507
var cancelBtnHtml = "<div onclick='hideModalDialog();'>" + SL_Modals["cancel"] + "</div>";
508508
showModalDialog(title, body, cancelBtnHtml, visitButtonHtml);
509509
e.stopPropagation();

Spixi/Resources/Raw/html/js/spixi.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,20 @@ function executeUiCommand(cmd) {
3434
function unescapeParameter(str) {
3535
return str.replace(/&gt;/g, ">")
3636
.replace(/&lt;/g, "<")
37-
.replace(/&#92;/g, "\\")
38-
.replace(/&#39;/g, "'")
39-
.replace(/&#34;/g, "\"")
37+
.replace(/&bsol;/g, "\\")
38+
.replace(/&apos;/g, "'")
39+
.replace(/&quot;/g, "\"")
4040
.replace(/&amp;/g, "&");
4141
}
4242

4343
function escapeParameter(str) {
4444
return str
4545
.replace(/&(?!#\d+;|#x[\da-fA-F]+;)/g, "&amp;")
46-
.replace(/</g, "&lt;")
47-
.replace(/>/g, "&gt;")
4846
.replace(/"/g, "&quot;")
49-
.replace(/'/g, "&#39;");
47+
.replace(/'/g, "&apos;")
48+
.replace(/\\/g, "&bsol;")
49+
.replace(/</g, "&lt;")
50+
.replace(/>/g, "&gt;");
5051
}
5152

5253
function quickScanJS() {

0 commit comments

Comments
 (0)