mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 10:40:01 -03:30
Merge pull request #2175 from marshmalien/fix/1496-inconsistent-ui-character-escaping
Use textContent property instead of innerHTML within sanitize filter
This commit is contained in:
@@ -289,7 +289,7 @@ function getProjectDetails () {
|
|||||||
|
|
||||||
const label = strings.get('labels.PROJECT');
|
const label = strings.get('labels.PROJECT');
|
||||||
const link = `/#/projects/${project.id}`;
|
const link = `/#/projects/${project.id}`;
|
||||||
const value = $filter('sanitize')(project.name);
|
const value = project.name;
|
||||||
const tooltip = strings.get('tooltips.PROJECT');
|
const tooltip = strings.get('tooltips.PROJECT');
|
||||||
|
|
||||||
return { label, link, value, tooltip };
|
return { label, link, value, tooltip };
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
export default [function() {
|
export default [function() {
|
||||||
return function(input) {
|
return function(input) {
|
||||||
input = $("<span>").text(input)[0].innerHTML;
|
input = $("<span>").text(input)[0].textContent;
|
||||||
return input;
|
return input;
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ describe('Filter: sanitize', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should sanitize xss-vulnerable strings', function(){
|
it('should sanitize xss-vulnerable strings', function(){
|
||||||
expect(filter("<div>foobar</div>")).toBe("<div>foobar</div>");
|
expect(filter("<div>foobar</div>")).toBe("<div>foobar</div>");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user