Skip to content
This repository has been archived by the owner on Aug 9, 2018. It is now read-only.

Commit

Permalink
Merge pull request #20 from saymedia/mimicUrlResolve
Browse files Browse the repository at this point in the history
Mimic the behavior of UrlResolve
  • Loading branch information
apparentlymart committed Apr 16, 2015
2 parents 2e55127 + 45c1d85 commit 6e280d1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/ngoverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,16 @@ function registerModule(context) {
}

var baseUrl = serverRequestContext.location.absUrl();
var normalizedVal = url.resolve(baseUrl, uri);

// mimic the behavior of UrlResolve
var normalizedVal;
if (uri === null) {
normalizedVal = url.resolve(baseUrl, '/null');
}
else {
normalizedVal = url.resolve(baseUrl, uri);
}

if (normalizedVal !== '' && !normalizedVal.match(regex)) {
return 'unsafe:' + normalizedVal;
}
Expand Down

0 comments on commit 6e280d1

Please sign in to comment.