Merge pull request #43 from lwch/dev

修正CodeQL问题
This commit is contained in:
李文超
2022-07-29 15:40:01 +08:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ var page = {
</div>`;
var obj = $(str);
obj.attr('id', 'tab-'+idx);
obj.find('iframe').attr('src', 'http://'+location.hostname+':'+$('#terms').val());
obj.find('iframe').attr('src', 'http://'+location.hostname+':'+escape($('#terms').val()));
$('#tab-content').append(obj);
page.idx++;
},
+7
View File
@@ -2,6 +2,13 @@ function arg(key) {
var url = new URL(location.href);
return decodeURIComponent(url.searchParams.get(key));
}
function escape(htmlStr) {
return htmlStr.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
var humanize = {
bytes: function(n) {
return humanize.humanate_bytes(n, 1024, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])