Explorar o código

Fix urls2links unit test

Haocen Xu %!s(int64=6) %!d(string=hai) anos
pai
achega
65011019b7
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 1 1
      js/privatebin.js
  2. 2 2
      js/test/Helper.js

+ 1 - 1
js/privatebin.js

@@ -408,7 +408,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
                 DOMPurify.sanitize(
                     element.html().replace(
                         /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
-                        '<a href="$1" rel="nofollow">$1</a>'
+                        '<a href="$1" rel="nofollow noopener noreferrer">$1</a>'
                     )
                 )
             );

+ 2 - 2
js/test/Helper.js

@@ -125,7 +125,7 @@ describe('Helper', function () {
                 let result = e.html();
                 clean();
                 url = $('<div />').text(url).html();
-                return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow">' + url + '</a>' + $('<div />').text(postfix).html() === result;
+                return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow noopener noreferrer">' + url + '</a>' + $('<div />').text(postfix).html() === result;
             }
         );
         jsc.property(
@@ -145,7 +145,7 @@ describe('Helper', function () {
                 let result = e.html();
                 clean();
                 url = $('<div />').text(url).html();
-                return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow">' + url + '</a>' + $('<div />').text(postfix).html() === result;
+                return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow noopener noreferrer">' + url + '</a>' + $('<div />').text(postfix).html() === result;
             }
         );
     });