Skip to content
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

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

jelbourn
Copy link
Member

@jelbourn jelbourn commented Oct 4, 2017

No description provided.

@jelbourn jelbourn requested a review from crisbeto October 4, 2017 19:24
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 4, 2017
@@ -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)))
Copy link
Member

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.

Copy link
Member Author

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)

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Oct 4, 2017
@kara
Copy link
Contributor

kara commented Oct 5, 2017

Looks like we still need to update a test here: https://travis-ci.org/angular/material2/jobs/283345030

@kara kara removed the action: merge The PR is ready for merge by the caretaker label Oct 5, 2017
@jelbourn
Copy link
Member Author

jelbourn commented Oct 5, 2017

Weird, failing only in IE11


// Assert that a registered icon can be looked-up by url.
iconRegistry.getSvgIconFromUrl(trust('cat.svg')).subscribe(element => {
expect(element.innerHTML).toContain('meow');
Copy link
Member

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');.

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Oct 11, 2017
@andrewseguin andrewseguin merged commit 291a87c into angular:master Oct 11, 2017
@jelbourn jelbourn deleted the icon-safe-url branch April 2, 2018 22:30
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants