Skip to content

Commit

Permalink
Merge pull request #1715 from plotly/ie-link-fix
Browse files Browse the repository at this point in the history
add empty protocol to link whitelist for IE relative links
  • Loading branch information
alexcjohnson committed May 23, 2017
2 parents 3771863 + b5f5168 commit d0aa27a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/svg_text_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ var TAG_CLOSE = {
sub: '<tspan dy="-0.21em">&#x200b;</tspan>'
};

var PROTOCOLS = ['http:', 'https:', 'mailto:'];
/*
* Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript
* and related attack vectors. The empty items are there for IE, that in various
* versions treats relative paths as having different flavors of no protocol, while
* other browsers have these explicitly inherit the protocol of the page they're in.
*/
var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':'];

var STRIP_TAGS = new RegExp('</?(' + Object.keys(TAG_STYLES).join('|') + ')( [^>]*)?/?>', 'g');

Expand Down

0 comments on commit d0aa27a

Please sign in to comment.