Skip to content

Commit

Permalink
more restricted URL regex in highlighter
Browse files Browse the repository at this point in the history
Disallow period or percent at the end of URLs.
  • Loading branch information
haarg committed Nov 8, 2015
1 parent 2c72394 commit 45d72f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions root/static/js/syntaxhighlighter.js
Expand Up @@ -32,8 +32,10 @@ $(function () {

var hashLines = /^#L(\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*)$/;

// Allow tilde in url (#1118). Orig: /\w+:\/\/[\w-.\/?%&=:@;#]*/g,
SyntaxHighlighter.regexLib['url'] = /\w+:\/\/[\w-.\/?%&=:@;#~]*/g;
// Original is /\w+:\/\/[\w-.\/?%&=:@;#]*/g
// Allow tilde, disallow period or percent as last character, and a more
// restricted scheme
SyntaxHighlighter.regexLib['url'] = /[a-z][a-z0-9.+-]*:\/\/[\w-.\/?%&=:@;#~]*[\w-\/?&=:@;#~]/gi;

// https://metacpan.org/source/RWSTAUNER/Acme-Syntax-Examples-0.001/lib/Acme/Syntax/Examples.pm

Expand Down

0 comments on commit 45d72f7

Please sign in to comment.