From f16af60eadf7abd3c8b52f6b72fc4ca2b6a58b08 Mon Sep 17 00:00:00 2001 From: npt-1707 Date: Mon, 17 Aug 2026 13:19:42 +0800 Subject: [PATCH] Fix XSS --- .../jquery/bootstrap/js/bootstrap.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/bootstrap/js/bootstrap.js b/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/bootstrap/js/bootstrap.js index 56621401c..a39f5715d 100644 --- a/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/bootstrap/js/bootstrap.js +++ b/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/bootstrap/js/bootstrap.js @@ -290,7 +290,10 @@ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) , href = $this.attr('href') - , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 + var target = $this.attr('data-target') || + (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 + + var $target = $(document).find(target) , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() @@ -421,7 +424,7 @@ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - $parent = $(selector) + $parent = $(document).find(selector) $parent.length || ($parent = $this.parent()) return $parent @@ -1332,7 +1335,7 @@ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - $parent = $(selector) + $parent = $(document).find(selector) e && e.preventDefault() @@ -1837,8 +1840,14 @@ * ================= */ $(document).on('click.carousel.data-api', '[data-slide]', function (e) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + var $this = $(this) + var href = $this.attr('href') + if (href) { + href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + } + + var target = $this.attr('data-target') || href + var $target = $(document).find(target) , options = $.extend({}, $target.data(), $this.data()) $target.carousel(options) e.preventDefault()