-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(icon): use SafeResourceUrl in getSvgIconFromUrl #7535
Conversation
@@ -201,7 +201,7 @@ export class MatIconRegistry { | |||
return observableOf(cloneSvg(cachedIcon)); | |||
} | |||
|
|||
return RxChain.from(this._loadSvgIconFromConfig(new SvgIconConfig(url))) | |||
return RxChain.from(this._loadSvgIconFromConfig(new SvgIconConfig(safeUrl))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it, it might be a good idea to rename the url
variable above to something along the lines of sanitizedUrl
to avoid confusion in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really the type should enforce passing the right thing around; I want to check with Martin about adding a brand to safe types (since they're empty they match everything)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like we still need to update a test here: https://travis-ci.org/angular/material2/jobs/283345030 |
Weird, failing only in IE11 |
src/lib/icon/icon.spec.ts
Outdated
|
||
// Assert that a registered icon can be looked-up by url. | ||
iconRegistry.getSvgIconFromUrl(trust('cat.svg')).subscribe(element => { | ||
expect(element.innerHTML).toContain('meow'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SVGs don't have innerHTML
on IE. This should be verifyPathChildElement(element, 'meow');
.
f15eb45
to
5aadee7
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.